Commit Graph

6852 Commits

Author SHA1 Message Date
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
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
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
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
Wang Xinyu 6917f6d453 Graphviz: De-duplicate node names in dot file 2025-12-09 11:00:53 -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
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
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
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
Martin Duffy 956d36d3cd instrumentation: Add postCMakeWorkflow hook
Issue: #27414
2025-12-03 16:00:37 -05:00
AJIOB 4fdfa0db1a file(ARCHIVE_CREATE): support multithreading compression
Relates: #27420
2025-12-03 02:45:30 -05:00
AJIOB cbf71b21b2 cli tar: support multithreading compression
Fixes: #27420
2025-12-03 02:45:30 -05:00
Craig Scott c98bec6ae6 Merge topic 'fileapi-compilerargs'
71a4e34d97 fileAPI: Expose CMAKE_<LANG>_COMPILER_ARG1
1e02926c9a fileAPI: Refactor toolchains schema to prepare for new version
3caa572c05 fileAPI: Output more info for test failures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11419
2025-12-02 16:27:43 -05:00
Brad King d6b76cdc87 Merge topic 'cps-validate-version'
cc508826b4 CPS: Validate package version
fb66a14da2 cmExportFileGenerator: Allow other message types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11458
2025-12-02 15:43:42 -05:00
Christian Walther 71a4e34d97 fileAPI: Expose CMAKE_<LANG>_COMPILER_ARG1
Compiler arguments coming from CC environment variables or multi-element
CMAKE_<LANG>_COMPILER variables set by toolchain files were previously not
exposed in the file API. Among other possible problems, this caused clients
to determine wrong system include paths and built-in preprocessor macros by
calling the compiler without these important arguments.

This is fixed by adding an optional "commandFragment" attribute to the
compiler description in the `toolchains` object, containing these arguments
as a command line fragment. This is already the form in which they are
internally stored in the CMAKE_<LANG>_COMPILER_ARG1 variable, so all that is
required is adding this variable to the set of exported variables, besides
some logic to omit it if empty.

Issue: #22568
2025-12-03 07:34:53 +11:00
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
AJIOB 5b87a5d53e cli tar: implement LZMA support
Fixes: #27433
2025-12-02 10:44:49 +03: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
Christian Walther 3caa572c05 fileAPI: Output more info for test failures
Add actual and expected values to the output for some possible failures in
the toolchains-v1 tests to make it easier to understand why a test failed.
2025-12-01 12:27:57 +01:00
Matthew Woehlke cc508826b4 CPS: Validate package version
Add version validation to cmExportPackageInfoGenerator. Specifically, if
a package uses the "simple" version schema (which is the default if no
schema is specified), validate that the specified version actually
conforms to the schema and issue an error if it does not. Also, issue a
warning if the schema is not recognized.
2025-11-26 17:04:26 -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