Commit Graph

13144 Commits

Author SHA1 Message Date
Brad King
291135c660 Merge topic 'test-CMakeLib'
1b2b4f7e5f Tests: Clean up CMakeLib test include directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11530
2025-12-19 09:48:45 -05:00
Brad King
1b2b4f7e5f Tests: Clean up CMakeLib test include directories
Most include directories are available as `CMakeLib` usage requirements.
2025-12-18 13:49:14 -05:00
Brad King
a9fea5246f Tests: Remove unused test code 2025-12-18 11:23:59 -05:00
Brad King
756c0757b2 Merge topic 'vs-link-defaults'
46e59b5168 Merge branch 'backport-vs-link-defaults' into vs-link-defaults
b6defd96c9 VS: Restore subsystem link flag for DLLs
91b9db90e5 VS: Restore subsystem link flag for DLLs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !11524
2025-12-18 10:30:20 -05:00
Brad King
da84370cff Merge topic 'sbom-export-generators'
8ec5a595cd cmSbom: Add documentation for `install(SBOM)` and `export(SBOM)`
83671f2d87 cmSbom: Add `export(SBOM)` build generators and unit tests
f2027a886b cmSbom: Add `install(SBOM)` generator and unit tests
dcadde3662 CPS: Refactor ForbidGeneratorExpressions into cmGeneratorExpression
bcb6f689a4 cmExportInstallFileGenerator: Allow overriding of CheckInterfaceDirs
6d6c37c90d cmPackageInfoArguments: Extract common values
8c6676b2ea cmFindPackage: Fix PACKAGE_VERSION not being set when rebuilding

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11396
2025-12-18 10:13:32 -05:00
Brad King
3d0b2ec54d Merge topic 'file-ARCHIVE_CREATE-compression'
e347176424 file(ARCHIVE_CREATE): Add controls for zip and 7z compression method/level

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11522
2025-12-18 10:02:18 -05:00
Brad King
b6defd96c9 VS: Restore subsystem link flag for DLLs
In commit 99d09ec45a (VS: Suppress MSBuild default link flags not
specified by project or user, 2025-06-17, v4.1.0-rc1~6^2) we removed our
default `-subsystem:...` link flag from `SHARED` and `MODULE` libraries
in Visual Studio generators for consistency with command-line generators.
However, unlike other flag suppressions for #27004, this change did not
just suppress MSBuild defaults, but actually changed flags the generator
was previously adding itself.

For the linker subsystem flag, consistency across generators should
perhaps achieved by adding the flag in other generators instead of
removing it from Visual Studio generators.  Restore the previous
behavior pending further investigation.

Issue: #27466
Fixes: #27464
2025-12-17 17:41:36 -05:00
AJIOB
e347176424 file(ARCHIVE_CREATE): Add controls for zip and 7z compression method/level
Fixes: #27463
2025-12-17 14:38:30 -05:00
Taylor Sasser
83671f2d87 cmSbom: Add export(SBOM) build generators and unit tests 2025-12-17 14:35:12 -05:00
Taylor Sasser
f2027a886b cmSbom: Add install(SBOM) generator and unit tests 2025-12-17 14:33:34 -05:00
Kevin Barre
07fe3f95ce CPack/DEB: Add CPACK_DEBIAN_COMPRESSION_LEVEL variable
Add a new variable `CPACK_DEBIAN_COMPRESSION_LEVEL` to control the compression
level used when generating Debian packages. This complements the existing
`CPACK_DEBIAN_COMPRESSION_TYPE` variable and allows finer control over the
compression performance vs. size trade-off. Supported values correspond to
the compression level accepted by the underlying compressor (e.g. gzip, xz,
zstd, etc.).
2025-12-17 14:27:10 -05:00
Brad King
70dcdffb1f Merge topic 'instrumentation-test-cleanup'
0b06a4cbbe instrumentation: Cleanup for RunCMake tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11518
2025-12-17 14:13:01 -05:00
Brad King
292f6fc360 Merge topic 'cpack-7z-zip-algorithms'
3db6cce657 cpack: 7z & zip supports compression algorithms
1e4b829279 cpack: restore broken archive compression methods

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11513
2025-12-17 14:11:52 -05:00
Brad King
c4a14e9b08 Merge topic 'file-LOCK-truncation'
8ada1bcf8c file(LOCK): Avoid truncating existing files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11514
2025-12-17 13:56:20 -05:00
Leslie P. Polzer
8ada1bcf8c file(LOCK): Avoid truncating existing files
Previously the command opened the lock file using fopen with "w" mode,
which truncates the file to zero length. This is unsafe because:

1. If the lock file path is a symlink, the target file gets truncated
2. Race conditions between path resolution and file opening can be
   exploited to truncate arbitrary files

An attacker can exploit this by creating a symlink at a predictable
lock file location pointing to a critical file (e.g., source files,
configuration, or system files). When cmake runs file(LOCK), it
follows the symlink and destroys the target file's contents.

Fix by changing the file mode from "w" (write/truncate) to "a"
(append). This creates the file if it doesn't exist but preserves
existing content, preventing data destruction attacks.
2025-12-17 13:49:41 -05:00
Brad King
2faa0ae303 Merge topic 'string-json-improvements'
1eb5ea3a64 Help(string(JSON)): Clarify that some modes can have zero members/indices
06e6f1e69f string(JSON): Add STRING_ENCODE mode
15973ff247 string(JSON): Add GET_RAW mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11516
2025-12-17 13:34:20 -05:00
Brad King
f5ddf7d8da Merge topic 'test-RunCPack'
3b8f32c60a Tests: Add RunCMake.CPack_{DEB,RPM} cases using RunCPack infrastructure
76249af81e Tests: Comment where RunCPack keeps sample projects for `RunCMake.CPack_*`
422d624764 Tests: Add option to enable CPack RPM generator tests explicitly
73aa35427b Tests: Add option to enable CPack DEB generator tests explicitly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11512
2025-12-17 13:28:13 -05:00
Brad King
be77e8f634 Merge topic 'cps-find-global'
df94baa828 find_package: Support GLOBAL for CPS imports

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11509
2025-12-16 15:25:26 -05:00
Martin Duffy
0b06a4cbbe instrumentation: Cleanup for RunCMake tests
- Add default instrumentation query for tests
- Ignore dev warnings by default and test experimental warning output
2025-12-16 11:50:43 -05:00
Kyle Edwards
1eb5ea3a64 Help(string(JSON)): Clarify that some modes can have zero members/indices 2025-12-16 11:14:16 -05:00
Kyle Edwards
06e6f1e69f string(JSON): Add STRING_ENCODE mode 2025-12-16 10:11:30 -05:00
Kyle Edwards
15973ff247 string(JSON): Add GET_RAW mode 2025-12-16 10:00:29 -05:00
Brad King
3b8f32c60a Tests: Add RunCMake.CPack_{DEB,RPM} cases using RunCPack infrastructure
Use the infrastructure from commit 0b3756a7e3 (Tests/RunCMake: Add new
infrastructure to run cpack, 2024-03-12, v3.30.0-rc1~386^2).
2025-12-16 09:05:24 -05:00
AJIOB
3db6cce657 cpack: 7z & zip supports compression algorithms
Fixes: #27461
2025-12-16 15:52:54 +03:00
Brad King
76249af81e Tests: Comment where RunCPack keeps sample projects for RunCMake.CPack_*
Help readers discover the infrastructure from commit 0b3756a7e3
(Tests/RunCMake: Add new infrastructure to run cpack, 2024-03-12,
v3.30.0-rc1~386^2).
2025-12-15 10:10:50 -05:00
Brad King
422d624764 Tests: Add option to enable CPack RPM generator tests explicitly 2025-12-15 10:10:17 -05:00
Brad King
73aa35427b Tests: Add option to enable CPack DEB generator tests explicitly 2025-12-15 10:08:36 -05:00
Matthew Woehlke
df94baa828 find_package: Support GLOBAL for CPS imports
Teach CPS import to respect `find_package(GLOBAL)`.

Fixes: #27370
2025-12-12 17:31:26 -05:00
AJIOB
94ae247d44 cli tar: support different algorithms for zip & 7z
Fixes: #27443
2025-12-11 12:00:31 -05:00
Brad King
6eab40fa4a Merge topic 'export-empty-args'
2151e5f79d export, install: Improve argument parsing
2e71df0156 export: Explicitly allow empty NAMESPACE
5564c2cd9a cmArgumentParser: Improve bad argument handling
3f38f9511b cmArgumentParser: Add support for MaybeEmpty<std::string>
1ec7201558 cmStringAlgorithms: Add cmStripWhitespace
2ca58c5ac9 set: Improve error message consistency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11472
2025-12-10 09:37:52 -05:00
Brad King
003d728faa Tests/RunCMake/TIClang: Remove unused link flags from test cases
Typos in commit 9ba0a54554 (TIClang: Add support for TI Clang-based
compilers, including tiarmclang, 2023-12-06, v3.29.0-rc1~4^2~1)
left the flags unused.  In particular, `CMAKE_<LANG>_LINKER_FLAGS`
does not exist.
2025-12-09 15:10:01 -05:00
Matthew Woehlke
2151e5f79d export, install: Improve argument parsing
Modify the `export(EXPORT)` and `install(PACKAGE_INFO)` commands to
actually enforce that certain arguments must be non-empty. With respect
to `export`, this is mainly targeted at CPS export, but ends up
affecting all flavors of `export(EXPORT)` because that is the level at
which argument parsing is performed.

Also, add unit tests to verify that the new rejection of arguments with
missing or empty values is working, update the existing tests due to
changes in error reporting, and remove no-longer-needed manual
validation of an empty `PACKAGE_INFO` argument.
2025-12-09 13:37:01 -05:00
Matthew Woehlke
5564c2cd9a cmArgumentParser: Improve bad argument handling
Tweak ArgumentParser::ParseResult to store errors as a set, rather than
concatenating them. Add a new method that a) also optionally checks for
unknown arguments, and b) reports errors using the `SetError` method of
`cmExecutionStatus`, which allows callers to `return false`, which is
less surprising when an error occurs. This improves consistency at call
sites, reduces duplication by moving the common task of complaining
about unknown arguments to a reusable method, and also produces somewhat
more concise messages in the case that multiple errors occurred.

Note that, for some reason, the parser is sometimes generating duplicate
errors, hence the use of a set rather than a list.
2025-12-09 13:37:01 -05:00
Brad King
e395f59159 Merge topic 'graphviz-dedup-dot'
6917f6d453 Graphviz: De-duplicate node names in dot file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11485
2025-12-09 11:26:05 -05:00
Brad King
1a50c29616 Merge topic 'genex-colon-parse-fix'
41c69f8c87 cmGeneratorExpression: Fix parser for adjacent colon and comma

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11481
2025-12-09 11:11:52 -05:00
Brad King
992ad9b79c Merge topic 'test-cleanup'
4a67306ddb Tests: Remove redundant CTestTestTimeout test
8f848dbc1f Tests/RunCMake/CTestCommandLine: Add case for ctest --rerun-failed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11490
2025-12-09 11:05:32 -05:00
Wang Xinyu
6917f6d453 Graphviz: De-duplicate node names in dot file 2025-12-09 11:00:53 -05:00
Brad King
b32e8f11d0 Merge topic 'normalize-sqlite-target-name'
d4754c1a0c FindSQLite3: Use package name as namespace

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11482
2025-12-09 10:59:16 -05:00
Brad King
4a67306ddb Tests: Remove redundant CTestTestTimeout test
It was superseded by commit 2f5eb1800b (Tests: Add RunCMake.CTestTimeout
test, 2020-01-13, v3.17.0-rc1~169^2~1) but was kept as a dependency of
the `CTestTestRerunFailed` test.  The latter has now been moved into
`RunCMake.CTestCommandLine`, so neither is needed.
2025-12-08 15:19:46 -05:00
Brad King
8f848dbc1f Tests/RunCMake/CTestCommandLine: Add case for ctest --rerun-failed
Remove the old `CTestTestRerunFailed` test.
2025-12-08 15:16:51 -05:00
Matthew Woehlke
2ca58c5ac9 set: Improve error message consistency
There are exactly two places that use `ParseResult::AddKeywordError`:
the parser itself, and the `set` command. Adjust the format of the
message generated by the latter to be consistent with the former.
2025-12-08 14:40:50 -05:00
Matthew Woehlke
d4754c1a0c FindSQLite3: Use package name as namespace
As we (hopefully) move toward a CPS world, it is helpful for imported
targets to use the package name as the namespace (as required by CPS).
Modify FindSQLite3 to do so. The old name is retained for compatibility.
2025-12-08 11:14:43 -05:00
Brad King
ad7afb6455 Merge topic 'fix-27422'
d4d2a6a19d cli tar: support compression level

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11479
2025-12-08 10:19:55 -05:00
Brad King
1b2210cdf0 Merge topic 'pdb-locations'
cd92cbae7e MSVC: Restore pre-4.2 default PDB paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11475
2025-12-08 10:17:37 -05:00
Craig Scott
c0eb0ad5ef Merge topic 'instrumentation-post-workflow'
956d36d3cd instrumentation: Add postCMakeWorkflow hook

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !11450
2025-12-07 19:27:41 -05:00
Ben Boeckel
cd92cbae7e MSVC: Restore pre-4.2 default PDB paths
Only force a compile PDB directory when PCH reusing.  This avoids
affecting behavior in unrelated situations.  However, PCH reuse requires
a known path so that the `copy_idb_pdb` logic can accurately generate
the copy instructions so that MSVC's rule that PCH use must use the same
PDB file can be adhered to.

Also revert the test suite adaptations from commit f78f592b78 (pchreuse:
defer target existence enforcement to generation time, 2025-06-16,
v4.2.0-rc1~481^2~4).

Fixes: #27401
2025-12-05 18:10:26 -05:00
Martin Duffy
41c69f8c87 cmGeneratorExpression: Fix parser for adjacent colon and comma
Update ParseGeneratorExpression to allow correct parsing of adjacent
colon and comma separators in either order.

Fixes: #27324
2025-12-05 14:12:31 -05:00
AJIOB
d4d2a6a19d cli tar: support compression level
Fixes #27422
2025-12-05 20:00:24 +03:00
Brad King
9149ac3f37 Merge topic 'fix-27420'
4fdfa0db1a file(ARCHIVE_CREATE): support multithreading compression
cbf71b21b2 cli tar: support multithreading compression

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11460
2025-12-05 09:04:58 -05:00
Brad King
e4737d1c4a Merge topic 'cli-tar-lzma'
5b87a5d53e cli tar: implement LZMA support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11465
2025-12-03 16:26:20 -05:00