Commit Graph

38295 Commits

Author SHA1 Message Date
Brad King e12ce158bc clang-tidy: fix bugprone-unintended-char-ostream-output lint 2025-10-30 17:43:17 -04:00
Alex Turbov 2ca11db2e3 pre-commit: version bump typos hook plus fix found typos
Backport commit 8de02a14c8 (ci(pre-commit): version bump `typos` hook
plus fix found typos, 2025-10-23) to the CMake 4.2 release branch.
2025-10-30 17:43:16 -04:00
Brad King a86b6c4db4 CMake 4.2.0-rc2 2025-10-30 09:03:07 -04:00
Brad King c727d96b40 Merge topic 'fbuild_compdb' into release-4.2
5e25ee691a FASTBuild: generate compile_commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11373
2025-10-30 08:57:58 -04:00
Eduard Voronkin 5e25ee691a FASTBuild: generate compile_commands
If `CMAKE_EXPORT_COMPILE_COMMANDS` is set use FASTBuild's `-compdb`
option in order to generate `compile_commands.json` file.

Fixes: #27345
2025-10-29 15:53:07 -04:00
Brad King 6ebf21a360 VS: Restore support for Intel Fortran projects
Refactoring in commit 3882718872 (VS: Decouple solution generation from
`.sln` file format, 2025-09-15, v4.2.0-rc1~154^2~3) accidentally dropped
Fortran targets from the generated VS Solution.

Fixes: #27346
2025-10-29 11:55:53 -04:00
Brad King 37d7b9820e Merge topic 'FASTBuild-optimize-try_compile' into release-4.2
f6abf8044a FASTBuild: Disable caching and distribution in try_compile builds

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11365
2025-10-28 09:40:34 -04:00
Brad King aef339b26f Merge topic 'instrumentation-exit' into release-4.2
236207b81a instrumentation: Fix snippet `result` field
d3add47973 Tests/Instrumentation: Remove unused files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11339
2025-10-28 09:38:49 -04:00
Brad King d2800671d9 Merge topic 'make-LINK_OPTIONS-position' into release-4.2
8fa4a4bf67 Makefiles: Position target-wide link flags consistently with other generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11355
2025-10-28 09:36:27 -04:00
Brad King 9d7393a0b0 Merge topic 'improve-cps-project-error' into release-4.2
f2b7184b98 cmPackageInfoArguments: Improve error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !11363
2025-10-28 09:28:11 -04:00
Eduard Voronkin f6abf8044a FASTBuild: Disable caching and distribution in try_compile builds
This avoids hashing the whole toolchain and makes `try_compile` faster.
2025-10-27 16:59:29 -04:00
Brad King 68e836d20b Merge branch 'backport-4.1-improve-cps-export-namespace-error' 2025-10-27 15:56:11 -04:00
Tyler Yankee 236207b81a instrumentation: Fix snippet result field
Give the actual exit code of the command from the snippet as intended;
currently, this always gives 0 for sub-commands like compile and link,
as well as `ctest`.

For now, the result in build snippets will be `null`.
2025-10-27 15:42:58 -04:00
Matthew Woehlke 86e647ef2a CPS: Improve invalid namespace error
When CPS export fails due to a dependency on an improperly named
external target, reiterate the "canonical namespace" in the error
message for clarity.
2025-10-27 14:40:34 -04:00
Matthew Woehlke f2b7184b98 cmPackageInfoArguments: Improve error message
When given the name of a project that doesn't exist, report it as an
"unknown project" rather than an "invalid project". This is more
consistent with other, similar reporting.
2025-10-27 12:29:40 -04:00
Marc Chevrier 8fa4a4bf67 Makefiles: Position target-wide link flags consistently with other generators
In particular, the `LINK_OPTIONS` target property was not placed
on link lines consistently with other generators.

Fixes: #27326
2025-10-27 10:41:47 -04:00
Brad King 0030253224 Merge topic 'instrumentation-show-only' into release-4.2
de3cb099a3 instrumentation: Add showOnly to ctest snippets
2976742520 instrumentation: Only quote arguments that contain a space

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !11337
2025-10-26 10:34:06 -04:00
Brad King 823362224f Merge topic 'fbuild_cuda' into release-4.2
2cfae5e140 ci: Add job for CUDA with FASTBuild generator on Linux
4135175337 FASTBuild: support CUDA language

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11324
2025-10-26 10:32:23 -04:00
Brad King c1fcff6bff Merge topic 'vs-pdb-file-name-path-if-file' into release-4.2
799bf33c5a VS: do not create `ProgramDataBaseFileName` entries without a filepath

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11338
2025-10-25 09:02:54 -04:00
Eduard Voronkin 4135175337 FASTBuild: support CUDA language
Fixes: #27318
2025-10-25 08:58:38 -04:00
Brad King 7708dfe9db Merge topic 'vs-slnx' into release-4.2
46b0202ce0 VS: Fix SLNX generation so CSharp projects build in the IDE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11341
2025-10-24 17:21:19 -04:00
Ben Boeckel 799bf33c5a VS: do not create ProgramDataBaseFileName entries without a filepath
The logic in commit f78f592b78 (pchreuse: defer target existence
enforcement to generation time, 2025-06-16, v4.2.0-rc1~481^2~4) caused
generator targets to always respond with something for compilation PDB
files. This may be a directory as the flag supports it (the then
compiler chooses the filename). However, one caller was expecting it to
always be a path to a file in order to specify the
`ProgramDataBaseFileName` element. However, this usage cannot be a
directory.

In addition to not having a PDB path at all, also verify that it is not
a path to a directory before creating the `ProgramDataBaseFileName`
element.

This was observed in builds using `import std` in Debug mode.

Fixes: #27320
2025-10-24 17:18:36 -04:00
Brad King cd28c759ff Merge topic 'cps-use-license' into release-4.2
94b6e36b6b find_package: Respect CPS license

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11343
2025-10-24 17:11:30 -04:00
Brad King e624610dda Merge topic 'FASTBuild-optimize-try_compile' into release-4.2
e42881422f FASTBuild: optimize try_compile builds

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11335
2025-10-24 17:00:05 -04:00
Martin Duffy de3cb099a3 instrumentation: Add showOnly to ctest snippets
Fixes: #27269
2025-10-24 11:08:52 -04:00
Martin Duffy 2976742520 instrumentation: Only quote arguments that contain a space 2025-10-24 11:08:39 -04:00
Brad King 46b0202ce0 VS: Fix SLNX generation so CSharp projects build in the IDE
Add an explicit solution-level per-project `Platform` for `.csproj`
projects even if it is the same as the solution-wide `Platform`.
Otherwise the VS IDE skips building it.

Fixes: #27330
2025-10-24 10:18:01 -04:00
Matthew Woehlke 94b6e36b6b find_package: Respect CPS license
Modify CPS import to set the `SPDX_LICENSE` on imported targets using
the specified package `license`, if present (and if none of the other
mechanisms for setting a license apply).
2025-10-23 14:30:30 -04:00
Eduard Voronkin e42881422f FASTBuild: optimize try_compile builds
The generator does a lot of tricks in order to make the "rebuild-bff"
target up-to-date immediately after the generation. We can skip all of
those during "TryCompile" runs, which should reduce configure time.
2025-10-22 17:32:48 -07:00
Eduard Voronkin 7953214454 FASTBuild: Explicitly disallow CUDA language since it is not implemented
Issue: #27318
2025-10-22 10:28:40 -04:00
Brad King f0422c006c Merge topic 'pch-reuse-from-without-pch-warning' into release-4.2
cb6423703a PrecompileHeaders: downgrade `REUSE_FROM` without a PCH to a warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11318
2025-10-20 13:47:48 -04:00
Brad King c88b1acec5 Merge topic 'fbuild_ide_args' into release-4.2
31b51340a1 FASTbuild: allow setting custom IDE args

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11319
2025-10-20 13:46:05 -04:00
Brad King 2813b08d69 Merge topic 'collect-genex-fix' into release-4.2
6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11322
2025-10-20 13:42:49 -04:00
Ben Boeckel cb6423703a PrecompileHeaders: downgrade REUSE_FROM without a PCH to a warning
Prior to f9bc615d (pchreuse: ban PCH reuse from targets which disable
PCH, 2025-06-15), using a target without PCH as a `REUSE_FROM` target
was not an error. Some projects had been doing this unknowingly.
Downgrade the fatal error into a warning so that such projects can at
least continue to build.

Fixes: #27316
2025-10-17 12:00:40 -04:00
Martin Duffy 6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex
Since commit 13c7bb5b0c (cmGeneratorExpression: Update strip function to
collect parsed expressions, 2025-04-08, v4.1.0-rc1~361^2~1), the logic
to strip generator expressions would error if the stripped expressions
were being collected and an expression without a `:` was found inside an
expression with a `:`. This resulted in an error when exporting a target
that contained such a generator expression in its link libraries or
compile definitions.

Address the error by checking whether the latest `$<` proceeded the
latest `:`.
2025-10-17 11:34:43 -04:00
Eduard Voronkin 31b51340a1 FASTbuild: allow setting custom IDE args
Allow users to set custom args
when FBuild is invoked via IDE.
2025-10-17 10:16:14 -04:00
Brad King 42c7246dca CMake 4.2.0-rc1 2025-10-16 09:11:41 -04:00
Eduard Voronkin 6fd6bfab6f FASTBuild: fix globbing for large projects
FASTBuild will replace `%1%` with
all the glob matches, which might
exceed command line limit on Windows.
Moreover, we don't need to pass all the
matches to the VerifyGlobs.cmake script.

Fixes: #27305
2025-10-15 09:17:41 -04:00
Brad King b230eb2302 Merge topic 'fix-export-link-interfaces' into release-4.2
b209c41dfa export(TARGETS): Restore EXPORT_LINK_INTERFACE_LIBRARIES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11309
2025-10-15 09:09:57 -04:00
Taylor Sasser b209c41dfa export(TARGETS): Restore EXPORT_LINK_INTERFACE_LIBRARIES
Refactoring in commit 998495cb49 (cmExportCommand: Port to
cmSubcommandTable, 2025-07-15) accidentally removed support for the
`EXPORT_LINK_INTERFACE_LIBRARIES` argument.  Restore it with a test.

Fixes: #27302
2025-10-14 13:03:22 -04:00
Matthew Woehlke b9f3adb0a6 install(EXPORT): Fail earlier if EXPORT is missing
Add an explicit check in `install(EXPORT)` that the export name is
non-empty. Since an empty-named export set will never exist, this is
always an error. Previously, however, the error would not be caught
until generate time. Now an error will be produced immediately.
2025-10-14 11:52:03 -04:00
Brad King 614d295c1e VS: Compute MSVC character set in CUDA-only targets
Fix commit 6874efb592 (MSVC: Always define a character set, 2025-09-24)
for CUDA in Visual Studio.
2025-10-10 17:07:36 -04:00
Brad King 19a61e56cf VS: Refactor MSVC character set selection 2025-10-10 16:55:02 -04:00
Brad King 10556731a1 Begin 4.2 release versioning 2025-10-09 10:22:10 -04:00
Brad King 32689113d7 Merge topic 'genex-target-intermediate-dir'
f195c9ef2a genex: Add TARGET_INTERMEDIATE_DIR expression
5c5634db52 cmGeneratorExpressionNode: Factor out HasKnownObjectFileLocation check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11217
2025-10-09 09:12:40 -04:00
Martin Duffy f195c9ef2a genex: Add TARGET_INTERMEDIATE_DIR expression
Fixes: #27196
2025-10-09 08:07:20 -04:00
Brad King 420be50b5e Merge topic 'depfile-empty'
2c300a4c0a Fix out-of-bounds read on empty gcc-style depfile

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11293
2025-10-09 08:03:25 -04:00
Kitware Robot 48b5d61970 CMake Nightly Date Stamp 2025-10-09 00:04:45 -04:00
Martin Duffy 5c5634db52 cmGeneratorExpressionNode: Factor out HasKnownObjectFileLocation check 2025-10-08 17:34:02 -04:00
Joerg Bornemann 2c300a4c0a Fix out-of-bounds read on empty gcc-style depfile
If a gcc dep file is read that contains no dependencies,
cmReadGccDepfile returns a valid std::optional containing an empty
vector. Check at the call sites in cmDependsCompiler whether the vector
is empty before trying to access the vector's elements.

Fixes: #27270
2025-10-08 11:37:15 -04:00