898 Commits
Author SHA1 Message Date
Brad King c512ae97ce Merge topic 'custom-rule-support'
386d1d874c Add support of custom rules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12361
2026-09-21 11:40:22 -04:00
Brad King 0b9b66d056 Merge topic 'test-langs-launchers'
584a9297c0 CUDA, HIP: Restore support for LINKER_LAUNCHER
aeb7c3295d Merge branch 'backport-test-langs-launchers' into test-langs-launchers
b63bcda722 CUDA, HIP: Revert false support for LINKER_LAUNCHER

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12519
2026-09-21 11:28:32 -04:00
Marc Chevrier 386d1d874c Add support of custom rules
Fixes: #27383
2026-09-20 11:43:10 +02:00
Brad King 653cac1ebf Merge topic 'doc-interface-dash'
0871947862 Help: Remove spurious hyphen from cmake-buildsystem(7) references
ba67e946eb Help/INTERFACE_LINK_DEPENDS: Reference genexes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12518
2026-09-18 08:01:43 -04:00
Tyler Yankee 584a9297c0 CUDA, HIP: Restore support for LINKER_LAUNCHER
Reapply the implementation in commits commits 77312cc6 (CUDA: Add
support for [CMAKE_]CUDA_LINKER_LAUNCHER, 2025-05-30,
v4.1.0-rc1~80^2~1) and cdf2a36f (HIP: Add support for
[CMAKE_]HIP_LINKER_LAUNCHER, 2025-05-30, v4.1.0-rc1~80^2).

Add a special case to expand the correct rule placeholder for these
languages, which is spelled `CMAKE_<LANG>_HOST_LINK_LAUNCHER`. Enable
the tests for these languages correctly. Re-document support under
CMake 4.5.

Fixes: #26967
2026-09-17 18:11:42 -04:00
Tyler Yankee aeb7c3295d Merge branch 'backport-test-langs-launchers' into test-langs-launchers 2026-09-17 18:08:42 -04:00
Tyler Yankee b63bcda722 CUDA, HIP: Revert false support for LINKER_LAUNCHER
The implementation in commits 77312cc6 (CUDA: Add support for
[CMAKE_]CUDA_LINKER_LAUNCHER, 2025-05-30, v4.1.0-rc1~80^2~1) and
cdf2a36f (HIP: Add support for [CMAKE_]HIP_LINKER_LAUNCHER, 2025-05-30,
v4.1.0-rc1~80^2) is broken, and the tests are wrongly configured
so as to never actually run. Revert the entire feature to avoid future
confusion, including documented support.

Enable the test for Fortran, which was added but untested by commit
d176a8c5ce (Fortran: Add support for [CMAKE_]Fortran_LINKER_LAUNCHER,
2025-05-26, v4.1.0-rc1~96^2), and whose implementation works.

Issue: #26967
2026-09-17 18:07:42 -04:00
Tyler Yankee 0871947862 Help: Remove spurious hyphen from cmake-buildsystem(7) references 2026-09-17 09:15:50 -04:00
Tyler Yankee ba67e946eb Help/INTERFACE_LINK_DEPENDS: Reference genexes 2026-09-17 09:15:26 -04:00
Brad King f5efe7a6b5 Merge topic 'xcode-embed-genex'
90c03329dd Xcode: Honor generator expressions in XCODE_EMBED_<type>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12499
2026-09-14 10:58:37 -04:00
Tor Arne Vestbø 90c03329dd Xcode: Honor generator expressions in XCODE_EMBED_<type>
Evaluate the XCODE_EMBED_<type> target property through the generator
expression evaluator before building the copy-files phase.  Xcode shares
one copy-files build phase across all configurations, so the embedded set
cannot vary by configuration.  Reject any expression whose result depends
on the configuration, matching the existing per-source diagnostic.

Fixes #28082
2026-09-11 16:45:25 +02:00
Brad King 216cc54531 Merge topic 'AUTOMOC-cxxmodules-support'
6280cc3df9 Autogen: Add AUTOMOC support for C++ module units
266c6f0109 Autogen: Factor out the info-file source-entry reader

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Vito Gamberini <vito.gamberini@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !12490
2026-09-11 09:16:10 -04:00
Joerg Bornemann 6280cc3df9 Autogen: Add AUTOMOC support for C++ module units
Process C++ module interface and partition units that are members of a
FILE_SET of type CXX_MODULES.  moc is run on such units and its
generated output is compiled as a module implementation unit of the same
module, as its own scanned translation unit rather than folded into
mocs_compilation.cpp.  Macro-less units get an empty placeholder; module
units and their dependencies are tracked in the autogen depfile and as
byproducts for correct incremental rebuilds.

This requires Qt 6.13, whose moc supports C++ module units.  With older
Qt nothing can be generated for a module unit, so a meta-object macro
found in one is reported as an error rather than left to fail later in
the compiler or the linker.  Such a unit is no longer handled as an
ordinary source, which also means its moc include directives are not
honored and AUTOUIC does not process it.

moc rejects a meta-object macro in a module implementation unit or a
private module fragment, and AUTOMOC does not work around that.
2026-09-10 13:13:11 +02:00
Brad King 3b34605661 Help: Describe IMPORTED_{LOCATION,IMPLIB}_<CONFIG> in more detail
Also link to `IMPORTED_CONFIGURATIONS` and `MAP_IMPORTED_CONFIG_<CONFIG>`.

Closes: #28076
2026-09-09 14:20:22 -04:00
Brad King 244b563b43 Merge topic 'autogen-vs-reduce-target-count'
d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
2b5ad7e395 Autogen: Register per-config timestamp file with its full path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12409
2026-08-24 12:31:33 -04:00
Joerg Bornemann 3329328e5c Help: AUTOUIC: Document how generated ui header files are named
The name of a generated ui header follows the '#include' directive that
requests it, not the location of the .ui file.  That was not written down,
and neither was the optional directory prefix such a directive may carry.

CMake nevertheless has to predict the name at configure time, in order to
register the generated header as a source of the targets in the directory.
The prediction assumes that the include prefix matches the location of the
.ui file relative to CMAKE_CURRENT_SOURCE_DIR, so it is wrong when the .ui
file lies outside of that directory, or lies in a subdirectory but is
included without a prefix.

Document both, along with the resulting symptoms, and point to Qt's
qt_add_ui() command, which takes the include prefix explicitly and
therefore needs no prediction at all.

Issue: #23523
2026-08-20 15:00:09 +02:00
Joerg Bornemann d963b87ab4 Autogen: Reduce the number of targets under Visual Studio
Commit 680fbb112a (Autogen: Enable depfile support for Visual Studio and
Xcode generators) disabled the PRE_BUILD optimization when a depfile is
used, because a PRE_BUILD event cannot carry depfile dependencies. Since
then, every target with AUTOMOC or AUTOUIC enabled gains an
'<ORIGIN>_autogen' and an '<ORIGIN>_autogen_timestamp_deps' target,
which the Visual Studio generators turn into two extra projects per
target in the generated solution.

Attach the autogen custom command to the origin target instead. The
custom command still carries the depfile, and the dependencies of the
origin target provide the ordering that
'<ORIGIN>_autogen_timestamp_deps' provides otherwise, because MSBuild
builds all referenced projects before any step of the referencing
project.

Use the conditions of the PRE_BUILD event, so that the
'<ORIGIN>_autogen' target keeps existing wherever it existed before
depfiles were enabled for the Visual Studio generators. In particular,
projects that name the target in add_dependencies() keep working.

Ninja and the Makefile generators keep the separate targets. Extra
targets have no cost for them, and '<ORIGIN>_autogen' has always existed
there.

The Xcode generator gained the same two targets per origin target in
4.4, but attaching the custom command there needs some more thoughts on
the per-config timestamp file first: Xcode rejects targets whose sources
vary by configuration, and with AUTOGEN_BETTER_GRAPH_MULTI_CONFIG the
timestamp file is per configuration.

Fixes: #28034
Fixes: #28033
2026-08-14 13:14:54 +02: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
Brad King 92fbd6d0e0 Merge topic 'reduce-utf-8'
96b3a4e6c7 Style: Replace some UTF-8 characters with ASCII equivalents

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12319
2026-07-27 09:56:23 -04:00
Brad King 96b3a4e6c7 Style: Replace some UTF-8 characters with ASCII equivalents 2026-07-24 09:55:14 -04:00
Brad King 0d9a4242e4 Merge topic 'alias-transparency'
17094eb572 ALIAS: Add test for generator expressions with ALIAS targets
5f8cc64695 ALIAS: Add support for add_dependencies for ALIAS targets
79e421b053 ALIAS: Add support for target_* commands
3b327695aa ALIASED_TARGET: Make property read-only
a121419908 ALIAS: Add support for set_property and set_target_properties commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12207
2026-07-09 10:06:32 -04:00
Arha Gatram 3b327695aa ALIASED_TARGET: Make property read-only
The ALIAS_GLOBAL property is read-only, so ALIASED_TARGET should be as
well. Even when set, there is no way to read the property value, so this
change gives an explicit error for users.
2026-07-07 07:32:35 -07:00
Marc Chevrier 08855d03c2 Add target properties to discover target's file set information
Currently, target properties related to file sets are specific to file set
type (for example "SOURCE_SETS"). This raises some concerns:
1. For each new file set type, 6 new properties are created which need a lot
   off documentation update
2. there is no "generic" way to discover file sets information

The new target properties (FILE_SET_TYPES, FILE_SETS_<TYPE>,
and INTERFACE_FILE_SETS_<TYPE>), in conjunction with the file sets
properties, enable a complete generic file sets information discovery.
2026-06-30 16:03:32 +02:00
Michael Kruse 0e142193ac Ninja: Honor Fortran_BUILDING_INTRINSIC_MODULES
In commit b65930a7a7 (Fortran: Add Fortran_BUILDING_INTRINSIC_MODULES
for building intrinsics, 2025-01-09, v4.0.0-rc1~223^2) we only
implemented the property for the Makefile generators.  Implement it
for the Ninja generators too.

Fixes: #26803
2026-06-17 10:47:10 -04:00
Brad King 90cbdcda78 Help: Make CMAKE_MSVC_RUNTIME_LIBRARY empty-string value more visible
List it alongside the other values instead of in prose.

Closes: #27829
2026-05-19 10:32:32 -04:00
Marc Chevrier 5f7a7aa263 FILE_SET: add SKIP_UNITY_BUILD_INCLUSION property support 2026-05-14 10:55:35 -04:00
Brad King bf3a43e4ad Merge topic 'JOB_POOL_COMPILE-FileSet-property'
8e6eec8125 FILE_SET: add JOB_POOL_COMPILE property support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12005
2026-05-05 10:55:51 -04:00
Marc Chevrier 8e6eec8125 FILE_SET: add JOB_POOL_COMPILE property support 2026-05-04 11:10:01 +02:00
Marc Chevrier f18ba89862 FILE_SET: add SKIP_LINTING property support 2026-05-04 10:16:06 +02: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
Brad King 89443e99d6 Merge topic 'vs-deploy-utility-fix'
6c0b499dab VS: Honor `VS_SOLUTION_DEPLOY` on targets created by add_custom_target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11970
2026-04-27 09:49:27 -04:00
Roman Lavrov b6367f723b Swift/Ninja: Emit modules separately from compilation
Add policy CMP0215 to emit `.swiftmodule` from a dedicated `-emit-module`
build edge for importable Swift targets in the Ninja generator.
Downstream targets can begin compiling as soon as the module interface
is ready, overlapping with upstream object compilation and linking.

When CMP0215 is NEW and CMP0157 is NEW, separate module emission is
enabled by default.  The `Swift_SEPARATE_MODULE_EMISSION` target
property (initialized by the `CMAKE_Swift_SEPARATE_MODULE_EMISSION`
variable) can override this per target.

The compile edge still passes `-emit-module` so that swiftc continues
to produce `.swiftdoc`; only the `.swiftmodule` output moves to the new
edge.

Also fix swiftmodule dependency edges in cmNinjaNormalTargetGenerator
to use IsLanguageUsed instead of GetLinkerLanguage, so C/C++ targets
whose linker language propagated to Swift do not produce spurious
implicit dependencies.

Closes: #27748
2026-04-24 15:58:18 -04:00
Maykol Irigoyen 6c0b499dab VS: Honor VS_SOLUTION_DEPLOY on targets created by add_custom_target
Fixes: #27772
2026-04-24 12:10:40 -04:00
Marc Chevrier e96c5ba13d Add the support of the wild linker
Fixes: #27755
2026-04-23 16:21:30 +02: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 5c5b68f44e FILE_SET: Add support for the SOURCES type
Fixes: #27550
2026-03-31 09:49:59 +02:00
Baudouin Feildel 313769e766 Rust: Add support for Rust editions with Rust_EDITION target property 2026-03-26 23:15:58 +01:00
Mickaël Germain d6ecae0600 VERIFY_*_HEADER_SETS: Create verification targets even when empty
Always create `<target>_verify_*_header_sets` targets and the aggregate
`all_verify_*_header_sets` utility targets when the corresponding
property is enabled, even when no matching headers exist.

When headers exist, an OBJECT library is created as before. When no
headers are found, a UTILITY target is created instead to avoid
warnings from tools like Xcode's libtool about empty static libraries.

Update documentation with `.. versionchanged:: 4.4` directives, update
tests, and add a release note.

Fixes: #27685
2026-03-17 20:42:00 -07:00
Mickaël Germain da42e4ed20 cmGeneratorTarget: Add OBJC/OBJCXX support to header set verification
Extend header set verification to support Objective-C and Objective-C++.
The supported-language table grows to {"C", "CXX", "OBJC", "OBJCXX"}
and the lattice join is updated so OBJCXX is chosen when both CXX and
OBJC sources are present. GenerateStubForLanguage emits .m/.mm stubs
and the relevant OBJC/OBJCXX standard properties are copied to the
verification target.

Add OBJC/OBJCXX test cases conditioned on CMake_TEST_OBJC, isolated in
dedicated project files to avoid affecting language inference for
unrelated targets. Update property documentation and add a release note.
2026-03-10 09:22:28 -04:00
Tyler Yankee 01e306dbde Help: Prefer spelling out 'semicolon-separated list'
Fixes: #27663
2026-03-03 09:27:44 -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
Vito Gamberini 70c1f0f43d Experimental: Remove import std experimental gate
Fixes: #27571
2026-02-07 09:03:43 -05:00
Ralf Habacker 3400248c1a Help: Add documentation for <target>_EXPORTS compile definition
Fixes: #27554
2026-02-02 11:07:01 -05:00
Garrett Campbell 1964be5d56 Help: Clarify DEBUGGER_WORKING_DIRECTORY documentation
Closes: #27523
2026-01-20 10:57:26 -05:00
Brad King 59c3422974 Merge topic 'pvs-analyze'
ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio
8f722e0fac cmList: Expose container reserve
5d1f269658 cmcmd: Allow passing object file to co_compile commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !11323
2026-01-19 09:30:58 -05:00
Brad King 18c98682f5 Merge topic 'verify-private-header-sets'
b61637f90f File sets: Add verification of private file sets
61df2e15a2 Help: Verification target also sets CXX_SCAN_FOR_MODULES to false
909b54023a File sets: Specify verify file set target names in one place
20219414c3 File sets: Always verify interface files sets of executable targets
c7a1d5ee58 Tests: Rename VerifyHeaderSets tests to VerifyInterfaceHeaderSets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11565
2026-01-19 09:27:59 -05:00
Martin Duffy ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio 2026-01-16 11:25:59 -05:00