Commit Graph

6749 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Brad King
7c284f4278 VS: Fix SLNX with multiple solution-to-project configuration mappings
Filter each mapping to apply only to its intended solution-wide config.

Fixes: #27385
2025-11-13 12:01:51 -05:00
Brad King
f49b0e6759 IWYU: Update for Debian 13 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:16 -05:00
Eduard Voronkin
d6bc1a8a50 FASTBuild: rename test target to RUN_TESTS
Avoid case-insensitive conflicts with project targets called `Test`.

Fixes: #27372
2025-11-11 08:54:54 -05:00
Brad King
666f0b1173 Merge topic 'test-libarchive-3.8.2' into release-4.2
576117b7eb Tests: Update expected Zstandard magic number for libarchive 3.8.2

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11402
2025-11-11 08:21:31 -05:00
Brad King
576117b7eb Tests: Update expected Zstandard magic number for libarchive 3.8.2
libarchive 3.8.2 enabled Zstandard's checksum feature in the zstd write
filter.  Update our tests' expected results accordingly.

Fixes: #27355
Reported-by: Funda Wang <fundawang@yeah.net>
2025-11-10 15:11:10 -05:00
Brad King
1803eda9f7 CPack/RPM: Backport "Fix detection of RPM support for weak dependencies"
Backport commit 283a48403f (CPack/RPM: Fix detection of RPM support for
weak dependencies, 2025-02-28, v4.0.0-rc3~8^2) to CMake 3.31.

Fixes: #27373
2025-11-10 11:40:49 -05:00
Matthew Woehlke
fa4bed7844 cmPackageInfoReader: Don't crash if input is malformed
Check all instances of converting a JSON value to a string to ensure
that we check first if the value is convertible, in order to avoid an
exception being thrown, which crashes CMake. Modify some instances to
report when we encounter such invalid values. (Many instances, however,
just silently ignore invalid values.)

Fixes: #27350
2025-11-05 11:29:13 -05:00
Matthew Woehlke
6c2fc502b6 find_package: Report why a candidate was rejected
Improve how find_package reports the list of candidate package
configuration files that were considered but rejected to include a
reason for rejection. For CPS in particular, this allows the user to
tell if a CPS file was rejected due to a version mismatch, missing
required components, or because the file could not be read.

While we do not try to report more detail for why cmPackageInfoReader
rejected a file, the possible reasons are usually easy enough to
distinguish:

- The file is so malformed that we cannot read a JSON object.
- The schema version is not a version that CMake understands.
- The root object does not contain a string named "name".
- The root object does not contain an object named "components".
- Prefix resolution failed.

Three of these can only result from a file that fails schema validation.
2025-11-05 10:45:23 -05:00
Matthew Woehlke
7cc114601a codespell: Prune ignore list
Remove entries from the codespell ignore list that do not seem to be
present any more. Also, remove a deliberate typo and instead add a local
annotation to ignore it.

This list is still uncomfortably long, but unfortunately current
versions of codespell do not offer any granularity in between annotating
individual uses (which is not practical in most cases) or globally
ignoring words (which is overly broad and risks missing real errors).
2025-11-04 13:13:09 -05:00
Brad King
d314d85ea5 Tests: Extend RunCMake.ParseImplicitLinkInfo for LLVMFlang 21.1.3 2025-10-30 17:43:16 -04:00
Brad King
b7ad081f1a Tests: Fix RunCMake.CXXModules compilation with Clang 21
Clang 21 now enforces placement of the module declaration:

    .../scan_properties/module.cxx:7:8: error: module
       declaration must occur at the start of the translation unit
2025-10-30 17:40:02 -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
Vito Gamberini
fb58de1a56 Tutorial: Add Step 0 to prepare the working environment
Adds a "Step 0" to the tutorial which discusses minutia about where to
get CMake, how to run it, and most importantly deals at length with
various generator issues which aren't covered elsewhere.
2025-10-29 09:49:23 -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
3ef5ce55db Merge topic 'python_debug_postifx_no_interpreter' into release-4.2
6a35c277d0 FindPython: Support getting DEBUG_POSTFIX without requiring Interpreter
43fec72adb Tests: Fix RunCMake.UseSWIG SetPOSTFIX case on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11345
2025-10-28 09:34:29 -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
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
Andrej730
6a35c277d0 FindPython: Support getting DEBUG_POSTFIX without requiring Interpreter 2025-10-27 10:27:32 -04:00
Andrej730
43fec72adb Tests: Fix RunCMake.UseSWIG SetPOSTFIX case on Windows 2025-10-27 10:27:32 -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
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
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
Tyler Yankee
d3add47973 Tests/Instrumentation: Remove unused files 2025-10-23 14:53:03 -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
7953214454 FASTBuild: Explicitly disallow CUDA language since it is not implemented
Issue: #27318
2025-10-22 10:28:40 -04:00
Brad King
e00b84ec13 Merge topic 'gtest-json-discovery-empty' into release-4.2
f67efb64ab GoogleTest: Restore support for empty discovered test list

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11326
2025-10-22 07:29:11 -04:00
Brad King
32485cd7e2 Merge topic 'fix-cmake_determine_linker_id-error-handling' into release-4.2
69e2f3f8ea Linker: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL set to ANY
576e63f28d Compilers: Use -print-sysroot output only with successful exit code

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11313
2025-10-22 07:25:35 -04:00
Ottmar Zittlau
f67efb64ab GoogleTest: Restore support for empty discovered test list
Since commit 1cdceae8e3 (GoogleTest: Parse discovered test list from
JSON output if supported, 2025-05-02, v4.2.0-rc1~533^2~2) we've
incorrectly tried to `return()` from a `macro()` when no tests are
available.  This led to the situation that a file that contains the test
details was not properly overwritten but still indicated that the test
target was not built.

Fixes: #27319
2025-10-21 11:39:19 -04:00
Brad King
3f3f52082e Merge topic 'fix-tests-regex-3' into release-4.2
5de7a09e77 Tests/RunCMake: Match dots more precisely, part 3

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11321
2025-10-21 11:27:30 -04:00
Brad King
c1565ed4e5 Merge topic 'fix-typos' into release-4.2
60273a364c Tests/RunCMake: fix version typo

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11325
2025-10-21 11:21:42 -04:00
AJIOB
5de7a09e77 Tests/RunCMake: Match dots more precisely, part 3 2025-10-20 14:45:24 -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
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