Commit Graph
382 Commits
Author SHA1 Message Date
Tyler Yankee dd44b41cbe cmake -E: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cmake -E` (i.e., an invalid mode; mode sub-arguments
are not tracked).
2026-09-11 08:23:37 -04:00
Tyler Yankee 7dacfea25d cmake -E: Refactor help string to struct
Having a well-defined formatting helper reduces risk of typos, but more
importantly, allows a future commit to reuse the list of available
modes.
2026-09-11 08:23:36 -04:00
Felipe Torrezan a17cbbee93 IAR: Add post-processing step in C-STAT outputs
Harmonize IAR C-STAT headers between the first-time analysis
and subsequent builds, which uses cached results.

It also removes spurious relative paths such as `"../` and
`..\` that might appear after a new line followed by a double quote.
Effectively this will display paths relative to CMAKE_SOURCE_DIR,
similarly to the IDE, which display paths relative to $PROJ_DIR$.

Update the IAR tests to match the new C-STAT outputs.
2026-08-26 23:10:43 +02:00
Felipe Torrezan 4a8aeff8e4 IAR: Update ichecks error message
Update the C-STAT Checks Manifest Handler to contain
explicit reference to C-STAT for facilitating diagnostics.
2026-08-26 22:35:23 +02:00
Felipe Torrezan 57fea01732 IAR: Fix malformed C-STAT command line
There was an issue with a malformed command line introduced in
commit c7d2a172 (IAR: Add support for C-STAT static analysis,
2025-04-08, v4.1.0-rc1~385^2), where the source file was
incorrectly passed as a parameter when executing `icstat` in
HandleIcstat(). `icstat` does not take the source file as a
direct parameter.
2026-08-26 22:18:45 +02:00
Ben Boeckel f188f74bbd KWSys: update for CopyWhen::{Always => Unconditional} rename
KWSys renamed `Always` to `Unconditional` because the former
conflicts with a X11 macro.
2026-08-08 10:25:19 -04:00
Chuck Atkins a887fda85e WINDOWS_EXPORT_ALL_SYMBOLS: Improve performance with Clang toolsets
- Separate definition files from object files while reading the
  generated input list.
- Add batch bindexplib interfaces.
- Preserve native Windows COFF parsing for ordinary objects.
- Collect objects requiring nm and pass them to one nm process through a
  response file. On non-Windows hosts, pass every object to nm.
- Request --print-file-name so single- and multi-object output use the
  same format.
- Recognize text, data, and MSVC vftable symbols; ignore known
  non-exported types and warn about unknown types.
- Capture nm stderr separately so diagnostics cannot corrupt stdout
  symbol records.

Closes: #27995
2026-08-05 10:58:20 -04:00
Daksh Mamodiya 9800bd2098 file(ARCHIVE_CREATE): Add PATTERNS_EXCLUDE option
Exclude files and directories matching the given patterns while creating
an archive, using libarchive's matcher for parity with file(ARCHIVE_EXTRACT).

Fixes: #27877.
2026-06-16 15:33:06 +02:00
Daksh Mamodiya 531f3b568c file(ARCHIVE_EXTRACT): Add PATTERNS_EXCLUDE option
Omit archive entries matching the given patterns when extracting or
listing. May be combined with PATTERNS; on overlap the exclusion
takes precedence.

Fixes: #27837
2026-06-11 02:04:36 +02:00
Brad King bfe5392276 Merge topic 'ctest-environment'
79c90b7afc cmSystemTools: Remove EnvDiff class
508a72fc1c cmCTestRunTest: Don't modify the current environment
61072fe317 cmcmd: Don't modify the current environment
31040ff609 cmEnvironment: Add class for environment modification
a5d0e0fb69 cmEnvironment: Introduce class for a set of environment variables
bf071f85fe cmSystemTools: Add env argument to RunSingleCommand
14edb7097f cmUVProcessChain: Add support for Environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11795
2026-03-12 14:00:59 -04:00
Daniel Pfeifer 61072fe317 cmcmd: Don't modify the current environment
Instead, pass the environment variables to the child process.
2026-03-11 21:06:05 +01:00
Alex Overchenko 0c355dfcf7 tar: Use UTF-8 as a default encoding
Use UTF-8 by default, as this has become common for cross-platform
archive distribution, and our previous default was platform-specific.

Also revert commit f590010167 (libarchive: Restore tolerance of archives
with non-OEM paths on Windows, 2026-01-23, v3.31.11~1^2).  Its primary
purpose was to tolerate UTF-8 paths when extracting archives, which we
now handle by default.

Issue: #26903
2026-03-11 14:17:49 -04:00
Alex Overchenko 21eb53e9eb tar: Add option to specify the encoding of archive pathnames
Use OEM by default for backward compatibility

Fixes: #26903
2026-03-11 08:44:44 +03:00
Brad King c96ae62157 Merge topic 'cmake-E-copy-t-flag'
16b8a1ba2a cmake -E copy_directory*: Add -t argument support
29dcbe4169 cmake -E copy_if_*: Add -t argument support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11693
2026-02-25 09:15:30 -05:00
Brad King e35eb114aa Merge topic 'windows-avoid-short-paths'
d314cad7f1 Ninja,Make,FASTBuild: Avoid unnecessary Windows short paths in placeholders
8099fe4436 CMakeParseImplicitLinkInfo: Fix detection of MSVC link.exe from quoted path
c211b5b7f3 Makefile: Pass includes response file using native path style
728b8b34c2 IAR: Fix `ichecks` invocation on Windows when not using short paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11717
2026-02-25 09:10:04 -05:00
Alex Reinking 16b8a1ba2a cmake -E copy_directory*: Add -t argument support
Fixes: #24568
2026-02-24 13:38:13 -05:00
Alex Reinking 29dcbe4169 cmake -E copy_if_*: Add -t argument support
Issue: #24568
2026-02-24 13:38:07 -05:00
Brad King 728b8b34c2 IAR: Fix ichecks invocation on Windows when not using short paths
In commit c7d2a17253 (IAR: Add support for C-STAT static analysis,
2025-04-08, v4.1.0-rc1~385^2) we accidentally assumed the path to
`ichecks` never has a space.  It worked because we always constructed
the path from a Windows "short path" to the compiler tool.  Avoid
relying on that.
2026-02-24 10:40:05 -05:00
Martin Duffy 50535776c5 cmake -E cat: Read from stdin when no other args are given 2026-02-19 16:33:06 -05:00
Kyle Edwards 3a45596703 cmake -E bin2c: Fix segfault in template placeholder options
If --template-array-placeholder or --template-length-placeholder
were specified without --template-file, a segfault resulted from
trying to read from a std::istream* that was set to nullptr.
Explicitly check to see if these options are set without
--template-file.
2026-01-23 10:33:10 -05:00
Kyle Edwards 3a893806bb cmake -E: Add bin2c mode
Run Tests/RunCMake/cmake-E-bin2c/generate_files.sh to regenerate the
following files:

- Tests/RunCMake/cmake-E-bin2c/long.c.txt
- Tests/RunCMake/cmake-E-bin2c/long_signed.c.txt
- Tests/RunCMake/cmake-E-bin2c/long_decimal.c.txt
- Tests/RunCMake/cmake-E-bin2c/long_signed_decimal.c.txt
- Tests/RunCMake/cmake-E-bin2c/hashes.cmake

Run it with --very-long to regenerate the following additional files:

- Tests/RunCMake/cmake-E-bin2c/very_long_params.cmake
2026-01-22 14:33:17 -05:00
Brad King 59c3422974 Merge topic 'pvs-analyze'
ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio
8f722e0fac cmList: Expose container reserve
5d1f269658 cmcmd: Allow passing object file to co_compile commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Overchenko <aleksandr9809@gmail.com>
Merge-request: !11323
2026-01-19 09:30:58 -05:00
Martin Duffy ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio 2026-01-16 11:25:59 -05:00
Brad King 6015ef807d cmake -E tar: Improve error message formatting
Do not print file paths with our prose line wrapping, which breaks
on spaces.
2026-01-16 08:53:28 -05:00
Martin Duffy 5d1f269658 cmcmd: Allow passing object file to co_compile commands 2026-01-13 11:29:23 -05:00
Kyle Edwards 394ab1fcfb cmake -E *sum: Add ability to read from stdin 2026-01-12 13:58:53 -05:00
AJIOB 0b376b1bda cli tar: support for raw compression 2026-01-06 09:49:58 +03:00
AJIOB e4e29aeb66 cli tar: extend supported compression methods 2026-01-06 09:49:57 +03:00
Brad King c94d70c345 cmUVProcessChain: Open output streams automatically
Avoid repeating the logic at every call site.
2025-12-19 07:52:29 -05:00
AJIOB 94ae247d44 cli tar: support different algorithms for zip & 7z
Fixes: #27443
2025-12-11 12:00: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
AJIOB cbf71b21b2 cli tar: support multithreading compression
Fixes: #27420
2025-12-03 02:45:30 -05:00
AJIOB 5b87a5d53e cli tar: implement LZMA support
Fixes: #27433
2025-12-02 10:44:49 +03:00
Ben Boeckel 366b25e62e ast-grep: simplify cmHasLiteral{Suf,Pre}fix with char literals 2025-11-20 12:14:14 -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 e290d4f2a3 cmake: Infer command set from role 2025-11-07 09:35:54 -05:00
Brad King 0b83750e14 cmake: Clarify name of role of internal instances
These instances do not run arbitrary cmake language code.
2025-11-07 09:35:54 -05:00
Brad King 57ea73f289 cmake: Load options scripts in script role
Some code paths load `.cmake` scripts to get `set(...)` options.
2025-11-07 09:35:54 -05:00
Brad King 0aab75bf0e cmake: Clarify name of enum backing CMAKE_ROLE property 2025-11-07 09:35:53 -05:00
Brad King 9e36f22684 cmake: Clarify name of enum identifying set of commands added 2025-11-07 09:35:53 -05:00
Eduard Voronkin 01147454e7 FASTBuild: Add generator
Fixes: #15294
2025-08-26 14:29:01 -07:00
Brad King b1186e1997 Merge topic 'stdio-terminal'
914803bf31 Makefile: Fix regression that prints unnecessary VT100 escape sequences
a0a9e48f85 StdIo: Fix Terminal abstraction to avoid unnecessary VT100 escape sequences

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11080
2025-08-14 09:18:15 -04:00
Brad King 914803bf31 Makefile: Fix regression that prints unnecessary VT100 escape sequences
Since commit 509c424472 (StdIo: Replace uses of KWSys Terminal with
StdIo::Print, 2025-05-08, v4.1.0-rc1~151^2~2) we print unnecessary VT100
escape sequences to establish normal text even when not intending to
print color.  In combination with `CLICOLOR_FORCE=1`, this breaks
detection of implicit link information from compiler driver output.

Fixes: #27137
2025-08-13 15:30:25 -04:00
Brad King d1be722330 Merge topic 'issue-24923-new-cli-tools'
8797912e4d cmake -E: Add copy_if_newer and copy_directory_if_newer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10957
2025-08-01 11:13:56 -04:00
Benjamin Buch 8797912e4d cmake -E: Add copy_if_newer and copy_directory_if_newer
Fixes: #24923
2025-07-31 10:55:59 +02:00
Ben Boeckel a3a190c006 cmcmd: also forward rsp files in .o directories 2025-07-29 09:44:03 -04:00
Ben Boeckel b121adaa04 Makefiles: pass the target name to cmake -E cmake_depends
When a shortened directory is used, the name of the target is not
accessible just by the path. Pass it explicitly.
2025-07-29 08:06:30 -04:00
Brad King 509c424472 StdIo: Replace uses of KWSys Terminal with StdIo::Print
The latter:

* uses a type-safe representation of text attributes,

* works with `StdIo::Console` to print arbitrary UTF-8 text in color, and

* writes VT100 sequences to Windows Consoles when supported, eliminating
  racy console text attribute changes in parallel `make` output.

Fixes: #22450, #26689, #26924
2025-05-19 08:19:10 -04:00
Brad King 3e88020aed StdIo: Replace uses of KWSys ConsoleBuf with StdIo::Console
Issue: #26924
2025-05-13 10:35:47 -04:00