Commit Graph

1136 Commits

Author SHA1 Message Date
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 King
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 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
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
Brad King
89d1e92c11 Merge topic 'flang-j-as-moddir'
db6b82ae54 LLVMFlang-Fortran: Use -J instead of -module-dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !11443
2025-11-25 11:13:07 -05:00
Tarun Prabhu
db6b82ae54 LLVMFlang-Fortran: Use -J instead of -module-dir
In flang, both -J and -module-dir support both joined and separate values. For
the -J option, these are of the form `-J<value>` and `-J <value>` respectively.
Once https://github.com/llvm/llvm-project/pull/168748 is committed, -module-dir
will only work with a separate value. Setting CMAKE_Fortran_MODDIR_FLAG to -J
ensures that both joined and separate styles will continue to work after that
change is made. As far as behavior is concerned, both -J and -module-dir are
aliases.
2025-11-24 14:25:21 -05:00
Vito Gamberini
fa10dc6c22 Experimental/CXXModules: Implement EcoStd Module Metadata parser
Adds a parser and serializer for the EcoStd Module Metadata format

RFC: https://github.com/ecostd/rfcs/pull/3

This adapts the existing experimental support for import std; to use
the new parser. The CMAKE_CXX_STDLIB_MODULES_JSON is now the canonical
variable for controlling how CMake discovers the stdlib module metadata,
and is used directly by compiler detection.

Toolchains can still override the __CMAKE::CXX## targets if they wish,
either in conjunction with CMAKE_CXX_STDLIB_MODULE_JSON or not. It is
possible to disable automatic detection of
CMAKE_CXX_STDLIB_MODULE_JSON by setting it to the empty string.

When available, the CMAKE_CXX_STDLIB_MODULE_JSON will be used to create
all requested C++ stdlibs which do not already have targets.
2025-11-18 11:39:59 -05:00
Dylan Ulis
765e420128 QCC: Remove "-Wp," prefix for qcc system include arguments
`-Wp` is not needed on modern QNX/QCC.
`-isystem` is supported directly since QNX 7.0

Fixes: #26912
2025-10-09 09:51:29 -04:00
Daniel Körner
3a34f7715e TIClang: Add flags for C17 standard
C17 is supported since version 1.3.
2025-10-07 11:11:52 -04:00
Ben Boeckel
2b85541e39 cxximportstd: support setting the import std metadata location
Some deployments may not be able to discover the metadata file reliably
(e.g., custom `clang` builds on macOS while using the SDK's stdlib or
distribution bugs). Allow users to force the location so that
compiler-driven detection doesn't have to bend over backwards for
unforeseen bugs.
2025-09-11 18:03:00 -04:00
Andreas Graf
7493bc6d4a GHS C/CXX compiler: add NDEBUG compile define for non-debug aka release builds
Fixes: #27203
2025-09-08 18:19:03 +02:00
Eduard Voronkin
01147454e7 FASTBuild: Add generator
Fixes: #15294
2025-08-26 14:29:01 -07:00
Brad King
2013b79a87 Merge topic 'qcc-8-cxx-lang-flag'
ea3280f15b Merge branch 'qcc-8-cxx-lang-flag-3.31' into qcc-8-cxx-lang-flag
166061629a QCC-CXX: use `-x c++` on 8+
dc7adb64f3 QCC-CXX: use `-x c++` on 8+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10992
2025-08-05 09:53:52 -04:00
Ben Boeckel
166061629a QCC-CXX: use -x c++ on 8+
The `-lang-c++` flag has been deprecated.
2025-08-01 20:51:22 -04:00
Ben Boeckel
dc7adb64f3 QCC-CXX: use -x c++ on 8+
The `-lang-c++` flag has been deprecated.
2025-08-01 20:51:03 -04:00
Michael Hirsch
0d758be222 MSVC: Enable C23 language support
Introduced support via `-std:clatest` in cl 19.39.
2025-07-22 13:50:44 -04:00
Yonggang Luo
9a720d96eb clang-cl: Add support for C23
Although there is no `cl -std:c23` flag, the underlying Clang compiler
does have a C23 mode we can activate by passing `-std=c23` through a
`clang-cl` wrapper flag.

Also port the fix from commit 30139913e9 (VS: Restore support for mixing
C++23 and C in one target with clang-cl, 2024-12-09, v3.31.3~10^2).

Fixes: #27038
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Co-authored-by: Brad King <brad.king@kitware.com>
2025-07-01 11:20:56 -04:00
Brad King
feba34c68a Merge topic 'link-flags'
d592558b8b cmLocalGenerator: Drop no-op link flag placeholder infrastructure
67639002ad Ninja,Makefile: Drop now-unused placeholders from link rule variables
951e4d3f62 Ninja,Makefile: Move builtin linker flags to <LINK_FLAGS> placeholder
6b618c6079 cmLocalGenerator: Clarify MODULE link flags placeholder population
c52a654aa1 cmLocalGenerator: Improve formatting of rule placeholder variable list
37cf9941ed UseEcos: Add missing placeholder in rules to link executables
fa61be5bc4 Embarcadero,OpenWatcom: Clear unused flags for creating shared libraries
124e40947c CMakeCommonLanguageInclude: Do not unset MODULE library flags when empty
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10869
2025-06-11 10:28:07 -04:00
Brad King
67639002ad Ninja,Makefile: Drop now-unused placeholders from link rule variables
Previously we used separate placeholders for builtin linker flags:

* CMAKE_<LANG>_LINK_FLAGS for EXECUTABLEs
* CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS for SHARED libraries
* CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS for MODULE libraries

These are now always replaced by the empty string, so drop them
from our rule variables.
2025-06-10 14:43:15 -04:00
Brad King
fa61be5bc4 Embarcadero,OpenWatcom: Clear unused flags for creating shared libraries
Clear `CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS` since no special
link flags are needed to create a DLL with these toolchains.
Our shared library creation rules do not reference the placeholder,
so this variable was never used.  However, we may soon teach the
generators to look it up directly.
2025-06-10 08:53:47 -04:00
Brad King
7b4c87edae ADSP: Do not pass executable link flags when creating a static library
This was done by mistake in commit d090159318 (ENH: add support for the
ADSP toolchains for Blackfin, Shark and TigerShark DSPs, patch from
Raphael Cotty, 2007-07-12, v2.6.0~1446), and preserved in the
generalization by commit e9eabb0dcd (ADSP: Configure compiler in
compiler module, 2022-03-24, v3.24.0-rc1~331^2~1).  Fix both places.
2025-06-09 16:08:33 -04:00