Commit Graph

13080 Commits

Author SHA1 Message Date
Brad King 7a7028eb48 Merge topic 'improve-subcommand-message-consistency'
a1a75f4008 cmake_file_api: Improve error message consistency
61143d7cef export: Improve error message consistency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11470
2025-12-02 15:32:01 -05:00
Brad King a294c9ac1a Merge topic 'fix-cps-arg-parsing'
41b6b07527 cmExportCommand: Fix PACKAGE_INFO argument parsing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11459
2025-12-02 15:20:14 -05:00
Matthew Woehlke a1a75f4008 cmake_file_api: Improve error message consistency
Remove literal text "subcommand" from error messages. This addresses the
other use of this and improves consistency (see preceding commit). Also,
omit some unnecessary articles, which also improves consistency.
2025-12-01 15:52:36 -05:00
Matthew Woehlke 61143d7cef export: Improve error message consistency
Remove literal text "subcommand" from error messages. Most other
commands report errors like "<command> <subcommand> <message>", where
the message does not include the literal text "subcommand". The `export`
command was one of two exceptions to this.
2025-12-01 15:41:18 -05:00
Brad King ccad6e8bdb Merge topic 'interface-libraries-duplicate-deps'
725ea968ac De-duplicate dependencies propagated through interface libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11440
2025-12-01 12:36:48 -05:00
Matthew Woehlke 41b6b07527 cmExportCommand: Fix PACKAGE_INFO argument parsing
While I'm unsure about why `cmPackageInfoArguments` was originally
written the way it was, in its current form, the way command sub-parsers
work, the parser never considers arguments associated with a sub-parser
if the sub-parser keyword isn't present. This means that the arguments
associated with `cmPackageInfoArguments` are treated as unknown, and the
logic to reject them being set if `PACKAGE_INFO` is not present can
never actually execute. Therefore, remove it, and remove the associated
(and effectively useless) `enable` argument to its `Check` method.

Instead, ensure that the package name is actually specified. The only
case in which the parser will create the `optional` associated with the
sub-parser arguments is if the relevant keyword (i.e. `PACKAGE_INFO`) is
present. However, while the associated value is `NonEmpty`, the way we
are using the parser does not actually enforce this, and it looks like a
correct fix may be a breaking change. Therefore, enforce it manually for
now.
2025-12-01 11:22:58 -05:00
Brad King 2d557e738d Merge topic 'pdb-compile-filename-setting'
1a8712d31a cmGeneratorTarget: always provide a compile PDB filename

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11445
2025-11-26 10:42:34 -05:00
Brad King 27c73ff457 Merge topic 'pdb-compile-filename-setting' into release-4.2
1a8712d31a cmGeneratorTarget: always provide a compile PDB filename

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11445
2025-11-26 10:42:33 -05:00
Brad King cd6e4b9214 Merge topic 'fix-fileset-export'
63fc96d856 export: Fix exporting targets with multiple file sets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11449
2025-11-26 10:36:18 -05:00
Brad King c379978e0d Merge topic 'fix-fileset-export' into release-4.2
63fc96d856 export: Fix exporting targets with multiple file sets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11449
2025-11-26 10:36:16 -05:00
Brad King 8afe7a3d2d Merge topic 'emscripten-arch-id'
5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11452
2025-11-26 10:02:26 -05:00
Brad King 68cd120b52 Merge topic 'emscripten-arch-id' into release-4.2
5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11452
2025-11-26 10:02:24 -05:00
Brad King bf4b9e92ea Merge topic 'emscripten-try_run'
a308ea38f3 Emscripten: Fix try_run to run the `.js` file and not the adjacent `.wasm`
ad91bc558a ci: Make node available to Emscripten tests
27cc5d58bf Tests/RunCMake/Emscripten: Add tests covering try_compile COPY_FILE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11451
2025-11-26 10:00:10 -05:00
Brad King cea034594f Merge topic 'emscripten-try_run' into release-4.2
a308ea38f3 Emscripten: Fix try_run to run the `.js` file and not the adjacent `.wasm`
ad91bc558a ci: Make node available to Emscripten tests
27cc5d58bf Tests/RunCMake/Emscripten: Add tests covering try_compile COPY_FILE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11451
2025-11-26 10:00:08 -05:00
Brad King 4f2ac4f564 Merge topic 'emscripten-fPIC'
86574083a8 Emscripten: Drop hard-coded -fPIC flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sam Clegg <sbc@chromium.org>
Merge-request: !11448
2025-11-26 09:57:42 -05:00
Brad King ab81620d17 Merge topic 'emscripten-fPIC' into release-4.2
86574083a8 Emscripten: Drop hard-coded -fPIC flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sam Clegg <sbc@chromium.org>
Merge-request: !11448
2025-11-26 09:57:40 -05:00
Simon Tatham 725ea968ac De-duplicate dependencies propagated through interface libraries
When processing an indirect dependency of target `A` on target `C` via
an interface library B, `cmComputeTargetDepends::AddTargetDepend` was
not checking for duplicate dependencies, so that if `A` depended on `C`
via multiple interface libraries, the dependency graph built in
cmComputeTargetDepends would have duplicate edges.  In a real project
(LLVM libc) this was causing cmake to consume multiple gigabytes of RAM.

Fixes: #27386
2025-11-26 14:48:45 +00:00
Brad King 2fcbbfcae4 Merge topic 'ExternalProject-env-mod'
8afe5f227c ExternalProject: Fix environment modification ops named with underscores

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11442
2025-11-26 09:45:21 -05:00
Brad King 1b29f0c669 Merge topic 'ci-bullseye'
c27b73e152 Tests: Teach RunCMake to tolerate more BullseyeCoverage lines

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11453
2025-11-26 09:41:12 -05:00
Brad King 5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID
Extend commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) to account for commit 7f0f382c55 (Provide
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID on more compilers, 2025-03-24,
v4.1.0-rc1~499^2).

Fixes: #27425
2025-11-25 15:46:16 -05:00
Brad King a308ea38f3 Emscripten: Fix try_run to run the .js file and not the adjacent .wasm
Since commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) we've considered the `.wasm` to be the `try_compile`
output because we need `COPY_FILE` to get it for extracting `INFO:`
strings during our inspection checks.  This breaks `try_run` because
`node`, used via `CMAKE_CROSSCOMPILING_EMULATOR`, expects the `.js`.
Revert to considering the `.js` to be the primary output file, but
switch to the `.wasm` in `COPY_FILE`'s implementation.

Fixes: #27421
2025-11-25 15:45:46 -05:00
Brad King ad91bc558a ci: Make node available to Emscripten tests 2025-11-25 15:45:46 -05:00
Brad King 27cc5d58bf Tests/RunCMake/Emscripten: Add tests covering try_compile COPY_FILE
Compiler inspection relies on `try_compile`'s `COPY_FILE` option to copy
the `.wasm` file because the `.js` does not have the `INFO:size` string.

Issue: #27421
2025-11-25 15:45:24 -05:00
Brad King c27b73e152 Tests: Teach RunCMake to tolerate more BullseyeCoverage lines
Update commit 57f2aa7c37 (Tests: Teach RunCMake to tolerate
BullseyeCoverage lines in test output, 2015-02-20, v3.3.0-rc1~411^2~3)
to also tolerate a prefix on BullseyeCoverage lines.
2025-11-25 14:33:13 -05:00
Vito Gamberini 63fc96d856 export: Fix exporting targets with multiple file sets
Reported-By: Eugene Shalygin <eugene.shalygin@gmail.com>
Fixes: #27412
2025-11-25 12:47:24 -05:00
Brad King 86574083a8 Emscripten: Drop hard-coded -fPIC flag
In commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) this flag was added as part of an attempt to support
shared libraries without requiring projects to set much themselves. That
attempt was reverted by commit d361bf365e (Emscripten: Drop hard-coded
-sMAIN_MODULE and -sSIDE_MODULE flags, 2025-09-18, v4.2.0-rc1~146^2).
Also avoid hard-coding `-fPIC`.  `POSITION_INDEPENDENT_CODE` is already
enabled for shared library targets.  Projects can enable it themselves
where `-fPIC` is needed outside of shared libraries.

Fixes: #27424
Issue: #27240
2025-11-25 10:32:04 -05:00
Ben Boeckel 1a8712d31a cmGeneratorTarget: always provide a compile PDB filename
As of commit f78f592b78 (pchreuse: defer target existence enforcement to
generation time, 2025-06-16) via !10887, the compile PDB directory is
always set. Some codepaths used the total computation as a signal to
build the path themselves. But the filename was not specified, so the
resulting filename ended up changing. Always create the filename as
expected.

Fixes: #27401
2025-11-24 22:43:52 -05:00
HannaWAR 2628c52e04 source_group: add genex support
Fixes: #19813
2025-11-24 21:08:46 +03:00
Brad King 8afe5f227c ExternalProject: Fix environment modification ops named with underscores
Extend commit e301cbffcc (ExternalProject: Set environment variables,
2025-04-09, v4.2.0-rc1~480^2) and commit 9cb590b843 (ExternalProject:
Fix lists and empty commands with environment modification, 2025-09-11,
v4.2.0-rc1~9^2) to match `_` in environment modification operation
names.

Fixes: #27409
2025-11-24 11:49:30 -05:00
Brad King 0fbb18d03b Merge topic 'fix-cps-export-definitions'
37b15eda3b CPS: Fix exporting definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11436
2025-11-22 18:53:00 -05:00
Brad King 976e8ef053 Merge topic 'fix-cps-export-definitions' into release-4.2
37b15eda3b CPS: Fix exporting definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11436
2025-11-22 18:52:58 -05:00
Brad King a4ee3a2bd1 Merge topic 'test-try_compile-error-formatting'
db1657b6a6 Tests/TryCompile: Improve error message formatting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11435
2025-11-22 18:51:48 -05:00
Matthew Woehlke 37b15eda3b CPS: Fix exporting definitions
Export compile definitions to CPS using the correct attribute name.

Fixes: #27403
2025-11-21 15:32:41 -05:00
Brad King db1657b6a6 Tests/TryCompile: Improve error message formatting 2025-11-21 14:49:08 -05:00
Brad King fdc1de26c9 Merge topic 'build-dir-override-presets'
19296f507d cmake --build: Allow CLI build dir to override presets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11425
2025-11-21 09:52:11 -05:00
Brad King e51188be38 Merge topic 'vs2026-arm64'
376b93f48f Tests/RunCMake/GeneratorToolset: Fix Visual Studio 18 2026 host arch on ARM64

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11432
2025-11-21 08:24:42 -05:00
Brad King 376b93f48f Tests/RunCMake/GeneratorToolset: Fix Visual Studio 18 2026 host arch on ARM64
This was missed in commit 3392b371e2 (VS: Add Visual Studio 18 2026
generator, 2025-08-20, v4.2.0-rc1~165^2~1).
2025-11-20 18:56:41 -05:00
Brad King bb0216e0a2 Merge topic 'cxx-module-metadata'
fa10dc6c22 Experimental/CXXModules: Implement EcoStd Module Metadata parser

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11422
2025-11-19 08:53:29 -05:00
Brad King ad4a773d0c Merge topic 'vs-slnx'
06178da668 VS: Add include_external_msproject detection of `.wapproj` type
b9ce07b85b VS: Add SLNX project types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11428
2025-11-19 08:47:07 -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
Brad King 06178da668 VS: Add include_external_msproject detection of .wapproj type
It is a Windows Application Packaging Project.

Issue: #27392
2025-11-18 11:18:17 -05:00
Brad King b9ce07b85b VS: Add SLNX project types
Extend commit e6aa7742b0 (VS: Generate .slnx files for VS 2026,
2025-09-17, v4.2.0-rc1~151^2) to add the `Type=` attribute on SLNX
`<Project>` elements.

Fixes: #27392
2025-11-18 11:10:22 -05:00
William Allen 19296f507d cmake --build: Allow CLI build dir to override presets
`cmake --build <dir>` and `cmake --build --preset <preset>` are currently
mutually exclusive options.  This commit allows `<dir>` to override the
build directory specified in a preset.  This change allows the requirement
for each build preset to have a configure preset to be dropped in a future
commit.

Closes: #27384
2025-11-17 15:10:38 -05:00
Brad King 6087f56da9 Merge topic 'GenEx-STRING'
fd7e305097 GenEx: Add $<STRING> generator expression
7564cbae12 GenEx: add new expressions for string comparisons
dab5e6ebb1 introduce cm::CMakeString class as helper for string() command
34c0c7754f cmString: add methods append and insert
ab60f1a010 Extend usage for cm::string_view for more flexibility

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11382
2025-11-15 09:10:50 -05:00
Brad King fcd9b4de43 Merge topic 'split-cxxmodules-testing'
3e7ffddf2f Tests/CXXModulesCompile: remove excess `examples/` directory
beabe25af1 Tests/CXXModulesCompile: rename examples to be shorter
9a8700296c Tests/CXXModules: split out compilation tests
2d988b7ec8 Tests/CXXModules: remove unused file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11300
2025-11-15 09:07:21 -05:00
Brad King 1b099307e4 Merge topic 'test-cmake-gui'
551937b4fb ci: Suppress hanging CMakeGUI test on macos-x86_64 jobs
2e5442eef5 Tests/CMakeGUI: Avoid QtTest internal timeout before ctest's timeout

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11421
2025-11-15 09:06:09 -05:00
Brad King 42d94ff876 Merge topic 'file-GET_RUNTIME_DEPENDENCIES-matching'
bf3f69834d file(GET_RUNTIME_DEPENDENCIES): Normalize paths before matching

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11351
2025-11-15 09:03:56 -05:00
Brad King 4e85f9078d Merge topic 'vs-slnx'
70ed720232 VS: Add SLNX default startup project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11420
2025-11-15 09:01:50 -05:00
Brad King 2e5442eef5 Tests/CMakeGUI: Avoid QtTest internal timeout before ctest's timeout
Issue: #27376
2025-11-14 15:22:25 -05:00
Brad King 70ed720232 VS: Add SLNX default startup project
At the time of commit e6aa7742b0 (VS: Generate .slnx files for VS 2026,
2025-09-17, v4.2.0-rc1~151^2), the VS 18 Insiders edition did not offer
support for specifying a default startup project in `.slnx` files.
This has since been added, so use it.

Fixes: #27387
2025-11-14 11:03:57 -05:00