Commit Graph

6783 Commits

Author SHA1 Message Date
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
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
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
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
Marc Chevrier
fd7e305097 GenEx: Add $<STRING> generator expression
Fixes: #27188
2025-11-14 16:44:29 +01:00
Marc Chevrier
7564cbae12 GenEx: add new expressions for string comparisons 2025-11-14 16:44:29 +01:00
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
Ben Boeckel
3e7ffddf2f Tests/CXXModulesCompile: remove excess examples/ directory
Now that the test is split, it doesn't make sense to have the directory
anymore. It also helps with shortening paths.
2025-11-14 09:27:00 -05:00
Ben Boeckel
beabe25af1 Tests/CXXModulesCompile: rename examples to be shorter
Perform the following renames on the example directory names to avoid
long paths:

- `build-database` → `builddb`
- `export` → `exp`
- `import` → `imp`
- `include-directories` → `incdirs`
- `interface` → `iface`
- `module` → `mod`
- `private` → `priv`
- `property` → `prop`
- `properties` → `props`
- `transitive` → `trans`
2025-11-14 09:27:00 -05:00
Ben Boeckel
9a8700296c Tests/CXXModules: split out compilation tests
The test is getting fairly large and timing out more and more often.
Split out actual compilation tests.
2025-11-14 09:26:51 -05:00
hanna.rusakovich
bf3f69834d file(GET_RUNTIME_DEPENDENCIES): Normalize paths before matching
Regex-based filtering should not have to account for slash differences.
Add policy CMP0207 for compatibility.

Fixes: #26202
2025-11-14 17:23:26 +03: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
Ben Boeckel
2d988b7ec8 Tests/CXXModules: remove unused file 2025-11-10 14:48:44 -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