1153 Commits
Author SHA1 Message Date
Brad King d37a1fc335 Merge topic 'automoc-predefs-msvc'
7c3ca57b91 MSVC,Clang: Set CMAKE_CXX_COMPILER_PREDEFINES_COMMAND for the MSVC ABI
0fd711348c Autogen: Pass WIN32 to moc when targeting the MSVC ABI
4a4a654814 Autogen: Keep stderr out of the generated moc_predefs.h
1c1258ad95 cmWorkerPool: Allow capturing process stderr separately

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12517
2026-09-22 10:14:46 -04:00
Joerg Bornemann 7c3ca57b91 MSVC,Clang: Set CMAKE_CXX_COMPILER_PREDEFINES_COMMAND for the MSVC ABI
The variable was only set by the GNU-like compiler modules, so AUTOMOC
never generated a moc_predefs.h for compilers targeting the MSVC ABI
and moc parsed headers without the compiler's predefined macros.

MSVC dumps its predefined macros with '/PD', which needs the conforming
preprocessor. Require VS 2019 16.8, because 16.7 and older ignore the
flag with warning D9002 and emit no macros at all. clang-cl takes '-dM'
through '-Xclang'. Both also echo the preprocessed source, so feed them
an empty translation unit. clang with the GNU driver is excluded from
'Compiler/GNU' as well when it simulates MSVC, so give it the usual
'-dM -E' command there.

Fixes: #28093
2026-09-18 11:35:02 +02:00
Brad King 047c617a77 Modules/Compiler: Prefer companion tools adjacent to compiler
Previously a versioned name in a later search path was preferred
over an unversioned name adjacent to the compiler.  Consider all
names in each directory before moving to the next directory.
2026-09-15 08:46:25 -04:00
Brad King ccf42522b8 Modules/Compiler: Improve formatting of code finding companion tools 2026-09-15 08:43:43 -04:00
Robert Maynard ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model
Fixes: #26120, #26810
2026-09-03 13:26:45 -04:00
scivision 32c8a4bd01 LLVMFlang: Add support for COMPILE_WARNING_AS_ERROR
LLVM/Flang has supported `-Werror` since version 13.
2026-08-31 12:05:01 -04:00
Brad King 8337f4e670 Merge topic 'ibm-flang-fix'
fbe5bcb7d3 IBMFlang: Rename compiler modules from IBMLLVMFlang

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12443
2026-08-27 10:50:27 -04:00
Kelvin Li fbe5bcb7d3 IBMFlang: Rename compiler modules from IBMLLVMFlang
These were missed in commit 4969297469 (IBMFlang: Rename compiler id
from IBMLLVMFlang, 2026-06-09, v4.4.0-rc1~7^2).
2026-08-26 16:36:13 -04:00
Brad King 10b4bf7e1e Merge topic 'flang-fortran-system-includes'
5d2974974b Flang: Do not use -isystem with classic flang

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12436
2026-08-26 09:24:06 -04:00
Zhiqiang Chen 5d2974974b Flang: Do not use -isystem with classic flang
Extend commit a8e7a1047a (GNU: Do not use -isystem with gfortran,
2015-03-26, v3.3.0-rc1~292^2) to cover classic Flang too.  It does
not search system include directories for Fortran `.mod` files.
2026-08-25 14:06:59 -04:00
Aditya Kamath cff46f99ee AIX: Disable LTO/IPO with GCC, which does not support it
The GNU compiler does not support LTO on AIX.
2026-08-24 13:52:21 -04:00
Brad King 3d5f989836 Merge topic 'clang-cl-absolute-source-path'
68491cedcf clang-cl: Fix C++ module scanning when cross-compiling from Linux

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12389
2026-08-12 11:47:02 -04:00
huangqinjin 68491cedcf clang-cl: Fix C++ module scanning when cross-compiling from Linux
Follow up commit ed48feeae8 (clang-cl: Add support for C++ modules,
2026-03-27, v4.4.0-rc1~428^2).  Prevent clang-cl from interpreting
absolute source paths as flags.

Fixes: #28036
2026-08-11 13:03:30 -04:00
Sharadh Rajaraman 1610aa22f4 Clang: Add support for import std when targeting the MSVC ABI
When Clang targets the MSVC ABI, discover the MSVC standard library's
import-std metadata discovery through the MSVC module logic.  Also
extend the latter to use `CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES`
and honor `CMAKE_CXX_STDLIB_MODULES_JSON`.

Closes: #26761
Signed-off-by: Sharadh Rajaraman <r.sharadh@outlook.sg>
2026-07-08 16:55:21 -04:00
Ben Boeckel 5537b3d60e Clang-FindBinUtils: find unprefixed clang-scan-deps binaries as well
Apparently Gentoo (and upstream builds) do not add prefixes to the
associated tools. Alas, such things exist, so we should support them.

Fixes: #27858
2026-06-11 16:10:03 -04:00
Brad King cd7328bd29 Merge topic 'cuda-add-std23-nvcc-support' into release-4.4
d01c9a429b CUDA: Add support for cuda_std_23 for nvcc 13.3+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12162
2026-06-11 10:25:32 -04:00
Arha Gatram d01c9a429b CUDA: Add support for cuda_std_23 for nvcc 13.3+
CUDA 13.3 has been released with support for `-std=c++23`.
2026-06-10 13:27:03 -04:00
Arha Gatram a0762d49b2 NVCC: Fix minimum MSVC version needed for cuda_std_20
Fix the version check from commit 0aeeb8160c (CUDA: Add support for
cuda_std_20 for nvcc 12.0+, 2022-12-09, v3.25.2~21^2).  Align the
minimum version of MSVC for supporting C++20 through `nvcc` with the
version present in `MSVC-CXX.cmake` .
2026-06-10 13:16:34 -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
Kelvin Li 9573345dec LLVMFlang: Enable ThinLTO support
Fixes: #27839
2026-06-01 15:28:01 -04:00
Matthew Woehlke 763cfbcac8 Diagnostics: "Fix" policy warnings in modules
Introduce a mechanism (via the private and undocumented `ISSUE_WARNING`
option to the `cmake_policy` command) to allow built-in modules to issue
policy warnings. Update modules to use this.

This allows modules to issue policy warnings with the `CMD_POLICY`
diagnostic type, which is consistent with internally issued diagnostics.
This also tends to simplify the logic for issuing such warnings in much
the way the helpers introduced in the previous commit did for the C++
code.
2026-05-20 15:32:57 -04:00
Brad King f53ee8be4b LLVMFlang: Fix flags for shared libraries on AIX
On most platforms we create shared libraries with `-shared` by default,
but on AIX we add `-Wl,-bnoipath` before the default is applied.
Explicitly specify `-shared` for LLVMFlang instead.

Also add compilation flags for position-independent code.

Fixes: #27818
2026-05-15 15:06:58 -04:00
Brad KingandSerguei E. Leontiev 713f4b76ee PellesC: Add C standard levels for Pelles C versions 9 through 12
Full C23 support was not added until version 12.

Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-05-14 10:37:46 -04:00
Marcel Laverdet 82b1e97362 c++modules: Relax clang EcoStd prereqs
The path-detection routine which sets a default value for
'CMAKE_CXX_STDLIB_MODULES_JSON' is too strict. If the variable is
already set then no additional detection is needed by cmake.

This is relevant when compiling with clang and linking against
Microsoft's STL.
2026-05-13 18:52:19 +02:00
Brad King 54590f1ae6 Merge topic 'iccarm-next'
6fe9de264b IAR: changes for the upcoming compiler version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12030
2026-05-12 10:46:03 -04:00
Brad King 20ccf97df8 PellesC: Configure linker mode for ASM_POASM
This was missed in commit a95fae2d36 (PellesC: Add support for ASM_POASM
language assembler, 2026-04-21).
2026-05-11 14:11:31 -04:00
Felipe Torrezan 6fe9de264b IAR: changes for the upcoming compiler version
Significant changes on the next major version of the IAR compiler
required some changes in CMake:

- __IAR_COMPILERBASE__ offers a fine grained versioning option
  in comparisom with __IAR_SYSTEMS_ICC__, which only referred
  to the IAR internal platform version.

- C++20 Language support added for Arm (v10.10.1+), where libc++
  is used by default.
2026-05-11 11:25:57 +02: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
Simon Maertens 65fbe16e16 NAG Fortran: Use -xldarg @ to pass response files to the linker
The `nagfor` compiler driver does not invoke the linker directly.
Instead it runs the system C compiler driver, which then invokes the
linker.  Passing `@` to NAG Fortran expands the response file before
it reaches the linker, which might lead to too long linker lines.
`-Wl,@`, used since commit 10d6c3a635 (NAG: Pass response files
through front-end to the linker, 2018-08-01, v3.13.0-rc1~244^2), can
lead to wrong placement of the response file on the linker line and
doesn't work at all when the response file is the only object file
passed to the NAG Fortran frontend.

Instead use `-xldarg @` to pass a response file through to the linker
without any intermediate expansion.  However, the response file
generated by Ninja can contain flags meant for the compiler driver,
so we need to disable response files for these flags altogether.

Fixes: #23577
2026-05-06 02:00:40 +01:00
Simon Maertens 6dc46638f4 NAG Fortran: Fix response file flag for creating archives
Since commit 10d6c3a635 (NAG: Pass response files through front-end to
the linker, 2018-08-01, v3.13.0-rc1~244^2) we use `-Wl,@` instead of `@`
in order to pass the response file through the `nagfor` compiler driver
to the linker.  However, this is not needed for the archiver.  Create
a separate rule variable so we can use different response file flags
for archiving and linking.

Issue: #23577
2026-05-05 20:07:17 -04:00
Brad King da33d606e6 PellesC: Add support for C language standards
Issue: #21536
Inspired-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-27 13:48:49 -04:00
Andrey Starodubtsev ff75907e9a IAR: Implement COMPILE_WARNING_AS_ERROR 2026-04-12 14:57:42 +03: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
scivision 1e9150439c NVHPC: Record C23 and C++26 support
NVHPC 26.3 documents support for `-std=c++26` [1].
The `-std=gnu*` flags were also added.

[1] https://docs.nvidia.com/hpc-sdk/archive/26.3/release-notes/index.html
2026-03-31 14:19:53 -04:00
Brad King ed48feeae8 clang-cl: Add support for C++ modules
Since commit 4a4986d28a (cxxmodules: support command templates for BMI
compilation, 2026-03-25, v4.3.1~2^2~1) we can express module interface
unit compilation to either object files or BMI-only in a way that works
with `clang-scan-deps` and `clang-cl` together.

Fixes: #25731
2026-03-27 15:39:33 -04:00
Brad King 7c2bd4f534 Clang-CXX: Flatten C++ module scanning conditions to reduce nesting 2026-03-27 15:39:33 -04:00
Brad King 0e47cd8c7b Merge topic 'bmi-only-command-template'
7ebb5687ab cmGeneratorTarget: use typename for `flag`
4a4986d28a cxxmodules: support command templates for BMI compilation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11871
2026-03-27 07:36:26 -04:00
Ben Boeckel 4a4986d28a cxxmodules: support command templates for BMI compilation
Some compilers (Clang) warn when using their BMI-only flag with `-c`.
Support a complete template for BMI compilation rather than an
additional flag to support such toolchains.

Fixes: #27600
2026-03-26 13:20:19 -04:00
Serguei E. Leontiev d60a5f278a OrangeC: Add C/C++ standards as of 7.0 2026-03-25 17:01:34 -04:00
Brad King 4e28855735 OrangeC: Improve compiler information module formatting 2026-03-24 15:24:22 -04:00
Brad King 7df028c1f2 OrangeC: Drop redundant nologo flag 2026-03-24 15:24:21 -04:00
Brad King 1657e9d9f1 OrangeC: Fix shared library creation in Makefile generators
Replace the Ninja-specific placeholders with those that work in
both Makefile and Ninja generators.

Fixes: #27716
2026-03-24 15:24:20 -04:00
Michael Ferrari aac53316e8 c++modules: Fix clang *.modules.json path on Windows
Before it would result in us writing the unescaped backslashes to
`CMakeCXXCompiler.cmake` resulting in invalid escape characters causing
the configure to error out.
2026-03-02 10:23:22 -05:00
Brad King c1d58d3f3d Experimental: Restore import std gate
Several problems with this feature came up while testing 4.3.0-rc1.
These include both broken stdlib distributions and regressions in our
implementation of the feature since CMake 4.2.

Revert commit 70c1f0f43d (Experimental: Remove import std experimental
gate, 2026-02-04, v4.3.0-rc1~61^2) except for its incidental fixes.

Remove the 4.3 release notes related to `import std`.

Rotate the experimental gate's UUID.

Issue: #27426
Issue: #27597
Issue: #27626
Issue: #27635
2026-02-26 17:19:19 -05: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
Ben Boeckel 75a30136a1 c++modules: Persist CMAKE_CXX_STDLIB_MODULES_JSON
And change checks to look for a value rather than definition. This fix
keeps the same set of test cases in `RunCMake.CXXModules` selected as
before.

Fixes: #27589
2026-02-10 21:07:29 -05:00
Vito Gamberini 70c1f0f43d Experimental: Remove import std experimental gate
Fixes: #27571
2026-02-07 09:03:43 -05:00
Tyler YankeeandBrad King 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 47924bd1ba AppleClang: Add C++26 support
Follow up commit 0183956d30 (Clang: C++26 support, 2023-05-16,
v3.27.0-rc1~85^2).

Fixes: #27486
2026-01-07 10:48:43 -05:00