220 Commits
Author SHA1 Message Date
Robert Maynard 00388f8576 cmake-cli: Deprecate -H
Fixes: #18341
2026-09-21 14:35:51 -04:00
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 27dedeaafd cmake: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cmake`, `cmake --build`, `cmake --install`, or
`cmake --workflow`.
2026-09-11 08:23:30 -04:00
Chuck Atkins 03e56cd338 Tests: Add cases covering nm handling for WINDOWS_EXPORT_ALL_SYMBOLS
Add `__create_def` coverage for:

- missing nm tools
- generator selection
- single- and multi-object inputs
- object paths containing spaces
- mixed object and definition inputs
- nm symbol classification
2026-08-05 10:58:08 -04:00
Tyler Yankee 4eda69be82 Tests: Centralize JSON schema validation
As the number of areas in CMake for which we've provided JSON schemas
has expanded, testing infrastructure has mostly been copy-pasted across
the relevant test suites. Unify it to a single reusable validator
script and CMake helper.
2026-07-24 09:55:23 -04:00
Brad King 91ea357c32 Merge topic 'warn-no-internal-modules'
d3bb3cafe9 Modules: not produce warnings for CMake internals

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12275
2026-07-17 10:32:36 -04:00
AJIOB d3bb3cafe9 Modules: not produce warnings for CMake internals
Fixes: #27896
2026-07-14 17:08:36 +03:00
AJIOB 9599d1b8d3 Tests: llvm_rc_full_run failed when excluded from RunCMake_TEST_FILTER 2026-07-14 12:53:51 +03:00
Brad King 5b0aee4961 Drop Visual Studio 14 2015 generator
This generator has been deprecated since CMake 4.2.  Remove it.
2026-07-03 11:53:32 -04:00
Martin Duffy bd059a9c54 Help: Allow command-line help of per-language and per-config variables
Extend commit 4e50320978 (Help: Allow help for arbitrary keywords,
2023-08-31, v3.28.0-rc1~31^2).
2026-05-19 15:10:11 -04:00
Brad King 111454d8e0 Merge topic 'cmake-diagnostics-state'
99318e49b9 Help: Mention when diagnostics were added
daec98ba61 Diagnostics: Fix passing diagnostic state to try_compile
e0b0ac4295 Diagnostics: Overhaul warnings in cmake-gui
ca5d569524 Diagnostics: Switch state to new system
618c074a8c Diagnostics: Use categories for presets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11855
2026-04-15 10:29:06 -04:00
Matthew Woehlke ca5d569524 Diagnostics: Switch state to new system
Add an additional state to the cmake instance to track diagnostics. Use
this to initialize any new/reset states we create so that other contexts
will inherit the diagnostic state from presets / command-line options.
Modify the front-end to map presets and -W command-line options to
manipulation of this new diagnostic state. Remove old members for
storing diagnostic state. Rework how diagnostic state is persisted.
Deprecate old, non-standard spellings for manipulating diagnostics.
Deprecate old 'dev' spelling for CMD_AUTHOR.

Note that this is a work in progress. Messaging has not yet been
updated, so the new state is not yet being used to control diagnostics,
and some of the logic to update the old state has been stripped (and
will eventually be removed entirely). Backward compatibility support for
the deprecated CMAKE_{WARN,ERROR}_DEPRECATED variables is only partially
implemented. The GUI's interface for manipulating warnings is partially
broken and needs to be overhauled. These tasks are being done in
separate commits in order to minimize review burden and keep the changes
per commit / per merge request more manageable.
2026-04-14 12:42:33 -04:00
Brad King ebb680c87f Merge topic 'cmake-P-script-case'
1707e4e0ed Merge branch 'backport-4.2-cmake-P-script-case'
a2f1866d86 Merge branch 'backport-4.0-cmake-P-script-case'
a3358bb66a cmake: Restore normalization of `-P` script to on-disk path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11930
2026-04-14 09:24:40 -04:00
Brad King 1707e4e0ed Merge branch 'backport-4.2-cmake-P-script-case' 2026-04-13 14:27:21 -04:00
Brad King a2f1866d86 Merge branch 'backport-4.0-cmake-P-script-case' 2026-04-13 14:23:26 -04:00
Brad King a3358bb66a cmake: Restore normalization of -P script to on-disk path
This was missed in commit ee83165923 (cmake: Explicitly normalize
input paths as they exist on disk, 2024-10-17, v4.0.0-rc1~597^2),
causing `CMAKE_CURRENT_LIST_FILE` in `cmake -P` scripts to be
regressed by the KWSys behavior change merged by commit e9bd437a43
(Merge branch 'upstream-KWSys' into normalize-input-paths,
2024-10-24, v4.0.0-rc1~589^2~1).

Issue: #27750
2026-04-13 12:25:20 -04:00
Matthew Woehlke 7097e6712c Tests: Fix -Wno-error=dev test
Commit 28f2d750ed (Add -Werror and -Wno-error command-line options,
2015-12-21, v3.5.0-rc1~61^2~1) added -W[no-]error along with tests, but
wrote the wrong name in the RunCMakeTest.cmake that actually runs the
test. As a result, the -Wno-error=dev test has never actually run, and
in fact the expected output had an incorrect line number. Fix the
expected output, and fix the RunCMakeTest.cmake to actually run the
test.
2026-03-17 13:09:08 -04:00
Robert Maynard bd605ba9e6 cmake --install: Support multiple --components
Issue: #25178
2026-03-09 13:47:58 -04: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 6db4676164 Tests: Comment intentional uses of UTF-8 in .cmake sources 2026-02-08 16:16:21 -05:00
AJIOB 39a3915022 cmd: implement json version output 2026-02-03 09:34:23 +03:00
Kyle Edwards 394ab1fcfb cmake -E *sum: Add ability to read from stdin 2026-01-12 13:58:53 -05:00
Brad King 77ea15b797 Tests: Add case covering cmake -E env with empty environment variable
Issue: #27285
2025-10-08 11:17:20 -04:00
Brad King 596383a4fe Merge topic 'sequential-bom'
54161c70d5 cmListFileLexer: Do not require files to be seekable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11162
2025-09-21 18:49:18 -04:00
Sergiu Deitsch 54161c70d5 cmListFileLexer: Do not require files to be seekable
Read the BOM sequentially and store the read bytes for later use if
these do not correspond to a BOM. This allows FIFO to be used as input,
e.g., for piping input or Bash process substitution.
2025-09-19 18:02:06 +02:00
Brad King cd46d8ec84 Merge branch 'backport-vs2026' into vs2026 2025-09-15 11:33:57 -04:00
Brad King 3392b371e2 VS: Add Visual Studio 18 2026 generator
Closes: #27213
2025-09-15 11:31:02 -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
Brad King b10daadd08 Deprecate Visual Studio 14 2015 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2025-06-26 09:27:24 -04:00
Brad King c393300e2b cmake: Restore acceptance of -DCMAKE_TOOLCHAIN_FILE=//... on non-Windows
POSIX specifies that two leading slashes have implementation-defined
interpretation, so CMake 3.31 and below did not normalize away leading
double slashes.  However, most implementations simply treat a leading
`//` as just `/`, so CMake 4.0 now normalizes them away when they do not
correspond to a network path on Windows.

This change exposed that we were not normalizing `CMAKE_TOOLCHAIN_FILE`
before passing its value to `include()` the first time if it was not
passed with the `FILEPATH` or `PATH` cache entry type.  Fix that.

Fixes: #27010
2025-06-23 10:37:59 -04:00
Brad King cf0f46ed85 Tests/RunCMake/CommandLine: Simplify --toolchain cases 2025-06-23 10:23:11 -04:00
Brad King cd4e72ca08 Normalize PWD environment variable before using it
In commit 5aed3ee49d (cmSystemTools: Add GetLogicalWorkingDirectory,
2024-10-28, v4.0.0-rc1~528^2~6) we incorrectly trusted `PWD` to be a
normalized path so long as its realpath matches the current working
directory.

Fixes: #26870
2025-04-15 09:37:08 -04:00
Brad King 01f92efeb0 Restore expansion of leading '~' as home directory in input paths
This was accidentally dropped by commit 622596c6b2 (cmSystemTools:
Re-implement ToNormalizedPathOnDisk without translation map, 2024-10-30,
v4.0.0-rc1~528^2~5).  Previously it was done by `CollapseFullPath`.
`cm::PathResolver` intentionally does not expand `~` because it makes
sense only for transforming input paths.  Teach `ToNormalizedPathOnDisk`
to handle it directly.

Fixes: #26827
2025-04-02 14:41:48 -04:00
Peter Kokot 9f2efc3270 Remove optional arguments from else() and end*() commands
This adds a brief explanation of the optional condition in the `else()`
and removes all legacy usages of `else()` and `end*()` commands.
2025-01-28 03:01:23 +01:00
Brad King f4aa34daa7 Tests/RunCMake: Update cmake_minimum_required versions to 3.10
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.10 where possible.
2024-10-03 11:52:22 -04:00
Brad King 241f923a6f Drop Visual Studio 12 2013 generator
This generator has been deprecated since CMake 3.28.  Remove it.
2024-08-28 14:13:05 -04:00
Brad King 810e33f67a Tests: Simplify tests for Visual Studio generators
Since commit 03c31b0395 (Drop Visual Studio 9 2008 generator,
2024-05-06, v3.30.0-rc1~134^2), some tests do not need to be
version-dependent.
2024-08-28 14:12:54 -04:00
Brad King 077691942a Merge topic 'cmake-list-cached-variables'
c55239e286 cmake: Add flag to list cache entries matching a regex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9644
2024-07-24 10:00:30 -04:00
Min Hsu c55239e286 cmake: Add flag to list cache entries matching a regex
Add a `-LR[A][H] <regex>` flag with similar functionality to `-L[A][H]`,
but instead of listing all cached variables, it show only specific
variables that match the name regex.
2024-07-23 10:19:22 -04:00
Martin Duffy 5b3fbd5f64 cmSystemTools: Add CMake config directory 2024-07-03 09:34:41 -04:00
Brad King 7330121467 Fix crash in target-specific commands called from initial cache script
Fixes: #26018
2024-06-01 06:28:26 -04:00
Brad King 03c31b0395 Drop Visual Studio 9 2008 generator
This generator has been deprecated since CMake 3.27.  Remove it.
2024-05-08 10:37:34 -04:00
Silvio Traversaro 06af18b9db cmake: Allow CMAKE_INSTALL_PREFIX to be set by environment variable
Fixes: #25023
2024-01-30 11:44:45 -05:00
Brad King 530deed998 Merge topic 'cmake-E-cat-stdin'
ab72846794 cmake -E cat: Add ability to print standard input

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8942
2023-11-06 10:35:45 -05:00
Kyle Edwards ab72846794 cmake -E cat: Add ability to print standard input 2023-11-03 09:03:25 -04:00
Kyle Edwards c4be9c914b cmSystemTools::RunSingleCommand(): Pass stdin to child process
Fixes: #25383
2023-11-02 10:04:00 -04:00
Martin Duffy 4e50320978 Help: Allow help for arbitrary keywords
Changes `cmake --help [arg]` to search `Help/*/` instead of `Help/command/`
Allows editors to easily display manual for `<cword>`
2023-09-27 18:01:12 -04:00
Brad King 75b573a628 Deprecate Visual Studio 12 2013 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2023-06-26 12:41:18 -04:00
Brad King 536c1de1d4 Drop Visual Studio 11 2012 generator
This generator has been deprecated since CMake 3.25.  Remove it.
2023-06-13 14:20:48 -04:00