1131 Commits
Author SHA1 Message Date
AJIOB 1d2f0120be Source: Reduce string allocations, part 3 2026-09-22 11:37:41 +03:00
Robert Maynard 616f65b379 Clang/CUDA: Warn when using offloading driver with RDC + PTX
Fixes: #28084
2026-09-15 11:01:04 -04:00
Brad King 61a5b7846b Merge topic 'clang-cuda-offload-linker'
5b416cbe77 ci: add job testing cuda13.2 with clang
64dac60df9 ci: Update cuda13.2-x86_64 base image to clang-23
ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12052
2026-09-07 08:45:35 -04:00
Robert Maynard ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model
Fixes: #26120, #26810
2026-09-03 13:26:45 -04:00
Daksh Mamodiya 5f3d66a024 VS: Don't set LinkToolExe for targets that don't drive linking
A pure ASM_NASM target has no linker of its own, so emitting
CMAKE_LINKER as <LinkToolExe> broke the build (TRK0005) when it was
not found.  Let MSBuild link via the toolset, as MSVC C/CXX targets
already do.

Fixes: #27458
2026-09-02 19:20:35 +05:30
Tom Osika 72ae7352d5 get_property: Refactor logic to shared function 2026-08-10 17:29:13 -04:00
Vito Gamberini ab1bd6f6c6 c++modules: Remove CXX_MODULE_STD and CMAKE_CXX_COMPILER_IMPORT_STD
Fixes: #27966, #27992, #28000
2026-08-03 10:05:34 -04:00
Vito Gamberini 00d8e23414 c++modules: use synthetic interface objects for import std
Fixes: #27999
2026-08-01 19:55:07 -04:00
Brad King 019a531f18 Merge topic 'fix-synth-preproc-cxx-options'
6fb8e308df c++modules: Account for preprocessor flags in compile options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12310
2026-07-24 08:16:37 -04:00
Vito Gamberini 6fb8e308df c++modules: Account for preprocessor flags in compile options
Fixes: #27973
2026-07-23 09:19:13 -04:00
Brad King 5c1f5210c9 Merge topic 'fix-imported-bmi-config'
82683ae8b0 c++modules: discover synth targets for all configs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12286
2026-07-17 10:52:58 -04:00
Vito Gamberini 82683ae8b0 c++modules: discover synth targets for all configs
Fixes: #26312
2026-07-16 12:10:02 -04:00
AJIOB ce9ac00844 Source: reduce string reallocations 2026-07-08 09:40:55 -04:00
Matthew Woehlke a5a9ec9113 TargetTypes: Extract target-related types to dedicated header
Move some target related enumeration types from `cmStateTypes.h` to a
new header, as these really aren't "state" types. Also, make
`TargetType` a strongly-typed enumeration.
2026-07-01 14:44:11 -04:00
Vito Gamberini 42d2d63235 c++modules: Copy props from BMI consumers more correctly
Fixes: #27891
2026-06-19 09:23:38 -04:00
Vito Gamberini 6d3e9d8220 c++modules: single import std target 2026-06-18 15:20:54 -04:00
Daksh Mamodiya 526c34c0b0 Source: Minor static-analysis cleanups
No behavior change:

* Avoid a redundant container lookup before insert by using the result
  of a single insert()/emplace() instead of find() followed by insert.
* Replace self-assigning substr() with resize()/pop_back() to shorten
  strings in place without an extra allocation.
* Remove a redundant nested condition identical to its enclosing if.
2026-06-05 16:47:09 +02:00
Brad King 5636aa7740 Merge topic 'cxx-module-usage-effects'
2049419196 c++modules: document BMI compatibility changes
bfba7f68af c++modules: Correctly calculate and apply usage effects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12116
2026-06-03 10:01:51 -04:00
Vito Gamberini bfba7f68af c++modules: Correctly calculate and apply usage effects
Usage effects describe the relationship between a provider and a
consumer of C++ module interface units. They encompass the flags and
features used to construct BMIs for those units. If the usage effects of
a provider and consumer match, then the provider's BMI may be reused
as-is. If they do not match, then a synthetic target describing the
interface units with the consumer's usage effects applied must be
created.

This commit makes three major changes to how usage effects are reified
in CMake. The first is simple, usage effect hashes now use compile
options and features as the input to their hash instead of the consumer
name. A simply warning flag filter is also applied, mostly to
demonstrate the mechanism. This is the "correct calculation" for usage
effects.

The second is more impactful, usage effects now entirely replace the
compile options of providers with those of consumers if unmatched.
Compile definitions, includes, and links remain unchanged. This is
necessary to ensure successful builds, but is a tricky semantic change.

The third is mostly source-facing, the discovery model for CxxModule
synthetic targets is no longer the global target namespace. Instead,
non-synthetic targets manage their synthetic derivatives. Every target
maintains a usage effect-keyed cache of synthetic targets. When
determining if a synthetic target is necessary, a given provider checks
for compatibility with itself, then for presence in the cache, and if
the cache misses a new synthetic target is created.

Fixes: #27597
2026-06-02 15:41:40 -04:00
Brad King fe0537fa03 Merge topic 'SKIP_PRECOMPILE_HEADERS-fileset-property'
c06d409f12 FILE_SET: add SKIP_PRECOMPILE_HEADERS property support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12129
2026-06-02 09:17:53 -04:00
Marc Chevrier c06d409f12 FILE_SET: add SKIP_PRECOMPILE_HEADERS property support 2026-06-01 18:39:23 +02:00
Marc Chevrier 831566997b Build database: add missing source file properties 2026-06-01 16:53:08 +02:00
Brad King 53198548ea Merge topic 'builddb-fileset-properties-support'
b81321f9db Build database: add file set flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12111
2026-06-01 10:50:01 -04:00
Marc Chevrier b81321f9db Build database: add file set flags 2026-05-29 14:35:10 +02:00
Brad King 645ca80972 Merge topic 'rust-make'
1102abd224 ci: Enable Rust tests in Fedora + Unix Makefiles configuration
03ac6b9c2b Rust: Update experimental UUID
8154a4bc5c Rust: Add support for compiling Rust with Makefile generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12105
2026-05-27 11:45:23 -04:00
Brad King 22c962a406 Merge topic 'build-databases-support-empty-configs'
575c3dd990 builddb: support builds with empty configuration
3469cc0a46 Tests/CXXModulesCompile: add a test for builddb with empty config
bf442e9deb Tests/CXXModulesCompile: fix `exp-builddb` name references in check scripts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12101
2026-05-26 16:20:21 -04:00
Baudouin Feildel 8154a4bc5c Rust: Add support for compiling Rust with Makefile generator 2026-05-25 22:18:25 +02:00
Ben Boeckel 575c3dd990 builddb: support builds with empty configuration
Rotates the UUID to indicate changed behavior.

See: https://discourse.cmake.org/t/15654
2026-05-22 13:51:06 -04:00
Matthew Woehlke a7415d243a Diagnostics: Simplify issuing policy warnings
Add and use a couple helper functions for issuing policy warnings. This
improves consistency and allows some simplification of many call sites.
(One or two instances in particular are greatly simplified.)
2026-05-20 11:55:13 -04:00
Matthew Woehlke 028d3183ad Diagnostics: Add POLICY, EXPERIMENTAL
Add new diagnostic categories CMD_POLICY and CMD_EXPERIMENTAL, both as
children of CMD_AUTHOR. Use the former when issuing policy warnings. Use
the latter when issuing experimental feature warnings.
2026-05-15 09:57:23 -04:00
Brad King 33d4082c8b Merge topic 'swift-module-name-hyphen'
933c59ffde Swift: Replace hyphens with underscores in default module name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11986
2026-04-29 10:28:34 -04:00
Evan Wilde 118ab41984 Swift: Build with a package name by default
Add policy CMP0216 to enable use of the `PROJECT_NAME` as the default
package name for Swift.

Issue: #26886
2026-04-28 15:30:44 -04:00
Evan Wilde 94faee3099 Swift: Add option to pass package name to swiftc invocation
Add a `Swift_PACKAGE_NAME` target property to specify the package name.

Fixes: #26886
2026-04-28 15:24:05 -04:00
Roman Lavrov 933c59ffde Swift: Replace hyphens with underscores in default module name
GetSwiftModuleName() returns the target name verbatim when
Swift_MODULE_NAME is not set, but hyphens are not valid in Swift
module identifiers.  Replace them with underscores so that targets
like swift-syntax get module name swift_syntax automatically.

Issue: #27748
2026-04-27 19:21:29 -04:00
Evan Wilde 635f71737c Swift: Factor out Swift-specific target flags
Swift started the trend of piling language-specific target flags in
`cmLocalGenerator::AddLanguageFlags`. Other languages have added their
own under language-specific `Add<Lang>TargetFlags`.
I'm refactoring where Swift piles on its language-specific target flags
to match the pattern other languages are using.
2026-04-27 10:45:14 -07:00
Matthew Woehlke 1309532390 Diagnostics: Use new methods
Find places that are currently relying on diagnostic-specific message
types to issue diagnostics and replace these with calls to the new
diagnostic methods.
2026-04-16 15:10:35 -04:00
Marc Chevrier 3e2765b354 c++modules: create synthetic targets only when needed
When the target has only private c++ modules, do not create a synthetic
target.
2026-04-06 16:52:18 -04:00
Brad King b73e1508ec Merge topic 'FILE_SET-CXX_SCAN_FOR_MODULES'
df0a2aca6d FILE_SET: Add CXX_SCAN_FOR_MODULES property for per-file-set scanning control

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !11890
2026-04-04 15:36:19 -04:00
Marc Chevrier df0a2aca6d FILE_SET: Add CXX_SCAN_FOR_MODULES property for per-file-set scanning control
This is more specific than both the target property and the
directory-wide source file property of the same name.
2026-04-03 09:29:29 -04:00
Marc Chevrier b001bc735a c++modules: Avoid adding file to multiple file sets in synthetic targets
The introduction of file set type `SOURCES` can raise error on a
duplicate file due to erroneous synthetic targets definition.
2026-04-02 11:32:52 -04:00
Marc Chevrier 5c5b68f44e FILE_SET: Add support for the SOURCES type
Fixes: #27550
2026-03-31 09:49:59 +02:00
Brad King 5eab2214a2 Merge topic 'rust-edition'
abe64ca2d3 Rust: Update experimental UUID
313769e766 Rust: Add support for Rust editions with Rust_EDITION target property
d0e39096b6 Rust: Fix unused import warning in RustOnly test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11852
2026-03-30 08:32:37 -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
Baudouin Feildel 313769e766 Rust: Add support for Rust editions with Rust_EDITION target property 2026-03-26 23:15:58 +01:00
Ben Boeckel 7ebb5687ab cmGeneratorTarget: use typename for flag
Since the typename doesn't show up on the right side.
2026-03-26 13:20:19 -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
Brad King c68b587abe c++modules: Fully revert implementation of per-importer BMIs for 4.3
Since commit 5898c8d2e0 (cxxmodules: Generate per-importer BMIs for
native targets, 2025-12-29, v4.3.0-rc1~43^2~1) we use synthetic targets
to perform per-importer BMI-only compilation of modules even from
in-project targets.  However, our BMI-only compile lines are still
generated from the `CMAKE_CXX_COMPILE_OBJECT` rule variable, which
contains `-c` or equivalent.  Clang expects `-c` and `--precompile` to
be mutually exclusive, leading to warnings, or errors with `-Werror`.

Follow up commit e5b1a23f27 (c++modules: Revert partial implementation
of per-importer BMIs for 4.3, 2026-02-27, v4.3.0-rc2~9^2) by reverting
the rest of the implementation from the 4.3 release.  Work toward fixing
the implementation will proceed in post-4.3 development.

Issue: #25539
Issue: #27600
Issue: #27597
2026-03-24 11:13:05 -04:00
Brad King 89fe07f800 Merge topic 'rust-rlib'
e6a544836b Rust: Update experimental UUID
881faf67e5 Rust: Switch to building .rs files to .rlib instead of native object files
942ddcdd36 Rust: Add support for position independent code

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11686
2026-03-21 10:18:21 -04:00
Baudouin Feildel 881faf67e5 Rust: Switch to building .rs files to .rlib instead of native object files
Each Rust source file given to a target is considered a separate crate
root. There's a concept of a "main crate root", which is the `.rs` file
that is given to the final linker phase in CMake. Other Rust source file
in a target are built as rlib separately.

The project can still build `.rs` files into object files by setting the
Rust_EMIT property on the desired source file.
2026-03-20 09:42:44 -04:00
Mickaël Germain 448dd01b1f cmGeneratorTarget: move header set verification to dedicated file
Move AddHeaderSetVerification, GenerateHeaderSetVerificationFile,
ResolveHeaderLanguage, and GenerateStubForLanguage out of the
monolithic cmGeneratorTarget.cxx into a new split file following
the existing cmGeneratorTarget_*.cxx pattern.
2026-03-19 12:08:37 -04:00