Commit Graph

6766 Commits

Author SHA1 Message Date
Brad King
3566a30938 Merge topic 'vs-slnx'
7c284f4278 VS: Fix SLNX with multiple solution-to-project configuration mappings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11415
2025-11-14 09:46:33 -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
8832f78dd6 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:35 -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
Brad King
02f3f5d801 Merge topic 'cmake-E-copy-system-errors'
fb7a904e90 cmcmd: report system errors on more filesystem operations
4795cb6550 Merge branch 'upstream-KWSys' into cmake-E-copy-system-errors
dc8cc945ee KWSys 2025-11-12 (1139f8a0)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11401
2025-11-12 11:59:48 -05:00
Frank Winklmeier
fb7a904e90 cmcmd: report system errors on more filesystem operations
Print the system error message in case of failure when calling
`CopyFileAlways`, `CopyFileIfDifferent`, `CopyFileIfNewer`,
`CopyADirectory` and `MakeDirectory`.

Remove unnecessary `cmSystemTools` wrappers for `CopyFileIfNewer` and
`CopyADirectory`.

Fixes: #18276
2025-11-12 11:53:35 -05:00
Brad King
515bb02443 Merge topic 'package-info-from-install-export'
34343922a5 install: Add ability to generate CPS from install(EXPORT)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11315
2025-11-12 11:53:07 -05:00
Brad King
8ff110d4be Merge topic 'test-pch'
dac2823975 Tests: Split RunCMake.PrecompileHeaders into multiple tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11410
2025-11-12 11:49:10 -05:00
Brad King
31c38f722a Merge topic 'fbuild_unique_names'
d6bc1a8a50 FASTBuild: rename test target to RUN_TESTS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11403
2025-11-12 11:42:13 -05:00
Brad King
dac2823975 Tests: Split RunCMake.PrecompileHeaders into multiple tests
The test runs many cases serially.  Split them into two groups to
enable more concurrency and shorter tests.
2025-11-11 14:11:32 -05:00
Matthew Woehlke
34343922a5 install: Add ability to generate CPS from install(EXPORT)
Add the ability to generate CPS package information when install(EXPORT)
is used. This relies on additional information to be passed to CMake,
and is intended as a way of getting CPS out of existing projects without
needing to make changes to the projects' CMakeLists.txt. (Particularly,
this feature is intended for package distributors, not project authors.)
2025-11-11 11:51:58 -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
5c1ec64d20 Merge branch 'test-libarchive-3.8.2' into update-libarchive 2025-11-10 15:11: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
Clinton Stimpson
5a18728cec CPack/Archive: Add support for setting UID/GID in archive
Add `CPACK_ARCHIVE_UID` and `CPACK_ARCHIVE_GID` options.

Add a policy to change the default to 0/0 to enable ownership
by root if unpacking as root.

Fixes: #12901
2025-11-08 09:25:08 -05:00
Brad King
b95d5b31ab Merge topic 'fix-cps-crash-on-bad-input'
fa4bed7844 cmPackageInfoReader: Don't crash if input is malformed
be99a82eee cmPackageInfoReader: Just use std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11390
2025-11-06 13:26:13 -05:00
Brad King
55b083c4a6 Merge topic 'improve-cps-find_package-failure-reporting'
6c2fc502b6 find_package: Report why a candidate was rejected

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11377
2025-11-06 13:24:38 -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
Brad King
543ca7f081 Merge topic 'improve-codespell'
7cc114601a codespell: Prune ignore list
d197474083 codespell: Ignore test output regexes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11388
2025-11-04 13:33:50 -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
8d16842e33 Merge topic 'file-CREATE_LINK-COPY_ON_ERROR-dir'
a73ddd2ddb file(CREATE_LINK): Implement COPY_ON_ERROR for directories
f719a36bc0 file(CREATE_LINK): Refactor error handling for removal of destination
0448f646a8 file(CREATE_LINK): Factor out dedicated test
a2a626055b cmSystemTools: Return KWSys Status from RepeatedRemoveDirectory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11311
2025-11-04 12:02:47 -05:00
Brad King
26f0290284 Merge topic 'GoogleTest-discovery-timeout'
daa7926c68 GoogleTest: Report timeout duration on discovery failure
d3cfc57f06 Tests/RunCMake/GoogleTest: Match discovery timeout message more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11374
2025-10-31 07:21:29 -04:00
Brad King
5524773d57 Merge topic 'ci-fedora-43'
2338d987d5 ci: use Fedora 43 images and environments
5219f383fe ci: update Fedora base images to Fedora 43
373e8ea652 clang-tidy: ignore warnings new in version 21
e12ce158bc clang-tidy: fix bugprone-unintended-char-ostream-output lint
2ca11db2e3 pre-commit: version bump `typos` hook plus fix found typos
d314d85ea5 Tests: Extend RunCMake.ParseImplicitLinkInfo for LLVMFlang 21.1.3
b7ad081f1a Tests: Fix RunCMake.CXXModules compilation with Clang 21

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11375
2025-10-31 07:12:29 -04:00
Hanna Rusakovich
a73ddd2ddb file(CREATE_LINK): Implement COPY_ON_ERROR for directories
Add policy `CMP0205` for compatibility with projects not expecting this.

Fixes: #27294
2025-10-31 08:42:59 +03:00
Brad King
0448f646a8 file(CREATE_LINK): Factor out dedicated test 2025-10-31 08:42:59 +03: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
daa7926c68 GoogleTest: Report timeout duration on discovery failure 2025-10-30 13:00:56 -04:00
Brad King
d3cfc57f06 Tests/RunCMake/GoogleTest: Match discovery timeout message more precisely 2025-10-30 11:23:53 -04:00
Brad King
ad166f4809 Merge topic 'export-system-includes-under-prefix'
b5793cf41b install(EXPORT): Fix SYSTEM include directories relative to install prefix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11354
2025-10-30 09:00:37 -04:00
Brad King
8eb6796779 Merge topic 'fbuild_compdb'
5e25ee691a FASTBuild: generate compile_commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11373
2025-10-30 08:58:00 -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
6ziv
b5793cf41b install(EXPORT): Fix SYSTEM include directories relative to install prefix
Fixes: #23393
2025-10-29 16:03:02 -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