Commit Graph

1581 Commits

Author SHA1 Message Date
Brad King
635b42c3ff Merge topic 'ibm-flang'
ee76398d23 IBMLLVMFlang: Add support for this compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12138
2026-06-04 10:09:27 -04:00
Brad King
6e995093d9 Merge topic 'fix-build-tree-prefix-leak'
fd660330e0 find_*: Avoid searching prefix derived from CMake's own source tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12122
2026-06-04 09:51:29 -04:00
Kelvin Li
ee76398d23 IBMLLVMFlang: Add support for this compiler
Add support for the `ibm-flang` compiler tool, a variant of LLVMFlang.

Closes: #27863
2026-06-03 18:35:46 -04:00
Daksh Mamodiya
fd660330e0 find_*: Avoid searching prefix derived from CMake's own source tree
When `cmake` is running from its own build tree, `CMAKE_ROOT` is in
the source tree and should not be used to derive a search prefix.

Fixes: #27853
2026-06-03 10:11:21 -04:00
Marc Chevrier
1ca1095736 Linker: enhance pushpop-state detection
Fixes: #27822
2026-06-01 16:50:34 +02:00
Brad King
db63557d6a Merge topic 'skip-compiler-check-support'
11adb3b7ae Linker/Windows-MSVC: check for a non-empty linker version
32c12e6901 Modules/CMakeLANGCompiler.cmake.in: quote linker version and frontend variant
31946711d3 CMakeDetermineCompilerSupport: support skipping compiler feature checks
71d908010f Modules/DetermineCompiler: support skipping compiler checks
e267321f93 Modules/DetermineCompiler: avoid the cache for ABI compilations
94f4c64461 Tests/RunCMake/ToolchainSkipsChecks: add tests for skipping compiler checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11917
2026-05-26 16:12:35 -04:00
Ben Boeckel
11adb3b7ae Linker/Windows-MSVC: check for a non-empty linker version 2026-05-21 20:48:45 -04:00
Marc Chevrier
7e42230e01 LLD linker: enhance portability
To ensure that the correct linker is selected (host or device link),
use the generic driver (i.e. lld) rather than a specific linker (like lld-link).

Fixes: #27826
2026-05-21 15:25:49 +02:00
Brad King
0e3c395205 PellesC: Fix architecture detection when enabling both C and ASM_POASM
We detect the architecture once and store it in `_PellesC_ARCH`.
Do not unset it after the first language is enabled.

This fixes commit bc51518821 (PellesC: Compile for architecture matching
LIB environment variable, 2026-05-07) by removing lines left from an
earlier draft of the change.

Issue: #21536
Reported-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-19 10:12:36 -04:00
Brad King
485b155cb9 Merge topic 'swift-pdb'
404f6bac3c Swift: support PDB emission with Swift

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12064
2026-05-19 09:04:41 -04:00
Saleem Abdulrasool
404f6bac3c Swift: support PDB emission with Swift
Swift supports CodeView/PDB for Windows (with active development ongoing
to make it the default). It is currently usable but does not have the
same fidelity as DWARF, but can be sufficient for many use cases. The
user is able to control this via flags. Wire up the necessary support to
allow `TARGET_PDB_FILE` to be used with Swift/Swift-only targets.
2026-05-16 09:05:46 -04:00
Brad King
95abfcbe51 LLVMFlang: Add support for MSVC_RUNTIME_CHECKS abstraction on Windows
Extend commit 2b2344b412 (MSVC: Add abstraction for runtime checks,
2025-01-22, v4.0.0-rc1~92^2) to cover LLVMFlang.  This is necessary
to configure with CMP0184's NEW behavior.
2026-05-15 17:30:47 -04:00
Brad King
f369fc8f56 Merge topic 'pellesc-windows-libs'
b91c1fc3a9 PellesC: Pass common Windows SDK libraries to linker by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12061
2026-05-15 10:11:28 -04:00
Brad King
5b68160cab Merge topic 'emscripten-shared-libs'
0182611a56 Emscripten: Restore linking shared libraries with `-shared` flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12058
2026-05-15 10:03:38 -04:00
Brad King
b91c1fc3a9 PellesC: Pass common Windows SDK libraries to linker by default
We already do this for MSVC and MinGW.  The linker ignores them
if no symbols are needed.

Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-14 11:34:36 -04:00
Brad King
0182611a56 Emscripten: Restore linking shared libraries with -shared flag
Prior to CMake 4.2.0, projects using the EMSDK's toolchain file while
also enabling `TARGET_SUPPORTS_SHARED_LIBS` would link shared libraries
using our default `-shared` flag plus whatever `-sSIDE_MODULE` flag
the project added, if any.  CMake 4.2.0 introduced builtin Emscripten
support, but since commit d361bf365e (Emscripten: Drop hard-coded
-sMAIN_MODULE and -sSIDE_MODULE flags, 2025-09-18, v4.2.0-rc1~146^2)
we still leave it to projects to add Emscripten-specific flags needed
to link shared libraries.

Restore the pre-4.2 behavior of adding the `-shared` flag.  In
particular, this is needed for upcoming Emscripten support for real
shared libraries.

Issue: #27240
2026-05-14 09:24:49 -04:00
Serguei E. Leontiev
884d312784 PellesC: Add makefile rules for preprocessor and assembly output
Issue: #21536
2026-05-11 14:55:38 -04:00
Brad King
bc51518821 PellesC: Compile for architecture matching LIB environment variable
Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-11 14:55:12 -04:00
Brad King
57a1945745 Merge topic 'exe-check'
8d48d755f0 Tests: Add missing execute_process result checks
a1b5c0da87 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
6b4432bc10 FindGit: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12011
2026-05-07 08:07:07 -04:00
scivision
a1b5c0da87 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
Capture the `execute_process` command's `RESULT_VARIABLE`.

Issue: #27782
2026-05-06 11:16:36 -04:00
Serguei E. Leontiev
7750b59f17 PellesC: Add support for long link lines using response files
Issue: #21536
2026-05-05 15:35:05 -04:00
Brad King
12e6c14e69 PellesC: Add default -Ze flag to support compilation against Windows APIs
The Pelles C compiler requires MS extensions to support `__declspec`
and other constructs needed to use Windows APIs.  Unfortunately the
flag also disables standard definitions, so restore them.

Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-04 10:47:08 -04:00
Serguei E. Leontiev
9db2cf5429 PellesC: Add default compilation and link flags
Specify debug symbols and optimization flags for each configuration.

Issue: #21536
2026-05-01 11:28:49 -04:00
Brad King
811bf8fb89 Merge topic 'LINKER_TYPE-wild'
e96c5ba13d Add the support of the wild linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11966
2026-04-24 09:16:32 -04:00
Marc Chevrier
e96c5ba13d Add the support of the wild linker
Fixes: #27755
2026-04-23 16:21:30 +02:00
Brad King
1be31e5b61 PellesC: Add support for Windows DLL module definition files
Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-23 09:33:32 -04:00
Brad King
a95fae2d36 PellesC: Add support for ASM_POASM language assembler
The Pelles C compiler does not support ASM, and the `poasm` assembler
uses a distinct syntax.  Add a dedicated language as we do for similar
cases from other vendors.  Leave documentation commented out for now
because the PellesC toolchain support in general is not yet documented.

Fixes: #27758
Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-22 14:42:00 -04:00
Brad King
efc3e90d0d PellesC: Move C-specific compile command to C-specific code path 2026-04-22 14:35:09 -04:00
Brad King
fec53c68cd PellesC: Add support for Windows Resources
The PellesC toolchain provides a `porc` tool to compile them.

Note that `polib` fails to archive resource files (`.res`):

    POLIB: fatal error: An internal error occurred

Turn off the static library part of the VSResource test.

Issue: #21536
Inspired-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-20 11:58:39 -04:00
Brad King
9fc0edced9 Merge topic 'treat-arm64-as-matching-arm64e-for-sysroots'
d68bed8397 Apple: Treat arm64 as matching arm64e when resolving arch sysroots

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11903
2026-04-13 10:53:03 -04:00
Brad King
41534f1571 Merge topic 'haiku-rescan'
9a342eb39b Haiku: Add support for RESCAN

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11919
2026-04-13 10:50:00 -04:00
Brad King
3bed3edd45 Merge topic 'Modules-use-NO_CACHE'
80abf737cc Modules: use `find_*(NO_CACHE)`
2c75267803 Modules/CMakeTest*Compiler: use `try_compile(NO_CACHE)`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11914
2026-04-13 10:48:10 -04:00
Ben Boeckel
80abf737cc Modules: use find_*(NO_CACHE)
Avoid manual cache management logic.
2026-04-12 08:02:28 -04:00
Trung Nguyen
9a342eb39b Haiku: Add support for RESCAN
Haiku also uses the GNU toolchain and therefore should support this
feature.
2026-04-11 06:04:50 +10:00
Tor Arne Vestbø
d68bed8397 Apple: Treat arm64 as matching arm64e when resolving arch sysroots
Xcode 26.4's iPhoneOS SDK advertises arm64e (not arm64) in
libSystem.tbd. After stripping the platform suffix, the arch list
contains arm64e, which doesn't match when CMAKE_OSX_ARCHITECTURES
includes arm64. As a result, arm64 falls through to the simulator
SDK, silently breaking iOS device builds.

Since arm64e is a superset of arm64 (all arm64e devices run arm64
binaries), we now fall back to checking for arm64e when arm64 is
not found in an SDK's architecture list.
2026-04-10 14:45:48 -04:00
Brad King
b7a5f2732d PellesC: Add minimal support for this C compiler
Add bare minimum functionality to compile C code and link on Windows.
Explicitly label tests that are expected to work with `CFLAGS=-Ze`.

Leave out documentation for now because this is not usable in general.

Issue: #21536
Inspired-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-07 09:43:24 -04:00
Colin Cross
39b998edee Android: Add future linux-arm64 CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG
Future NDK versions may support linux `aarch64` hosts.  Teach CMake to
set `CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG` to `linux-arm64` on them.
2026-03-30 17:02:12 -04:00
Serguei E. Leontiev
402d72b6c0 OrangeC: Add support for compiling Windows Resources
OrangeC 7.0 and above come with a resource compiler, ORC.
2026-03-25 17:01:34 -04:00
Willem Deconinck
2b2cea3037 NAG-Fortran: Add support for WHOLE_ARCHIVE on Linux 2026-03-23 17:15:35 -04:00
Brad King
c6c2e8efc1 Merge topic 'fbuild_fix_clang_cl_manifest'
30ce1cfdcb FASTBuild: fix clang-cl build with manifests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11823
2026-03-17 09:05:05 -04:00
Eduard Voronkin
30ce1cfdcb FASTBuild: fix clang-cl build with manifests
Fixes: #27691
2026-03-16 11:52:50 -04:00
Aditya Vidyadhar Kamath
3e99e8efb2 AIX: Teach ExportImportList to use toolchain-specific nm
This is needed to handle LTO objects.

Fixes: #27655
2026-03-09 14:35:19 -04:00
Nilsen84
ed0f48e79b clang-cl: use gcc depfiles over /showIncludes
This enables `#embed` dependencies when using `clang-cl`.

Fixes: #27594
2026-02-13 10:44:50 -05:00
Gavin Zhao
73051ad572 fix: build HIP on Windows with MSVC-style clang-cl.exe 2026-02-05 18:55:24 -05:00
Tyler Yankee
98f9874703 cmake: Add per-language link flags for all target types
Previously, `CMAKE_<LANG>_LINK_FLAGS` was an undocumented variable used
for linking executables only. Re-spell that variable mirroring the
existing spellings for shared and module libraries, and add policy
CMP0210 to preserve compatibility.

Then, repurpose `CMAKE_<LANG>_LINK_FLAGS` to provide a variable to be
used for per-language link flags for all target types, along with a
per-configuration variant. These are added to the `<LINK_FLAGS>` rule
placeholder in the generators.

Fixes: #21934
Relates: #25620

Co-authored-by: Brad King <brad.king@kitware.com>
2026-01-31 19:37:09 -05:00
Brad King
1e4f9c2394 macOS: Remove outdated condition for -search_paths_first link flag
We no longer support versions of macOS older than 10.4.
2026-01-26 12:19:08 -05:00
Eisuke Kawashima
0837fb552f IntelLLVM: Remove unused code
In commit a90d2a9eed (IntelLLVM: Add support for Intel LLVM-based
compilers, 2020-11-02, v3.20.0-rc1~89^2~20) we added a `set()` that is
immediately followed by another `set()` of the same variable.  Remove
the former.

Fixes: #27019
2025-12-01 16:26:58 -05:00
Brad King
86574083a8 Emscripten: Drop hard-coded -fPIC flag
In commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) this flag was added as part of an attempt to support
shared libraries without requiring projects to set much themselves. That
attempt was reverted by commit d361bf365e (Emscripten: Drop hard-coded
-sMAIN_MODULE and -sSIDE_MODULE flags, 2025-09-18, v4.2.0-rc1~146^2).
Also avoid hard-coding `-fPIC`.  `POSITION_INDEPENDENT_CODE` is already
enabled for shared library targets.  Projects can enable it themselves
where `-fPIC` is needed outside of shared libraries.

Fixes: #27424
Issue: #27240
2025-11-25 10:32:04 -05:00
Brad King
75e98477e3 Emscripten: Restore placement of source files on compile command-lines
Since commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3), compilation command-lines for Emscripten place
`-c <SOURCE>` before all the flags.  Restore the original order.

Fixes: #27404
2025-11-24 14:49:19 -05:00
Brad King
863dc3a7ac VS/Android: Use ApplicationTypeRevision 3.0 in VS2026
Extend commit e78abf94e3 (VS/Android: Use ApplicationTypeRevision 3.0 in
VS2022, 2023-04-21, v3.27.0-rc1~165^2~4) to cover VS 2026 too.  This was
missed in commit 3392b371e2 (VS: Add Visual Studio 18 2026 generator,
2025-08-20, v4.2.0-rc1~165^2~1).
2025-11-20 14:06:11 -05:00