323 Commits
Author SHA1 Message Date
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
56b3136f60 fileapi: Add build properties for SOURCES file set type to codemodel
This complements commit 5c5b68f44e (FILE_SET: Add support for the
SOURCES type, 2026-03-12).

Co-Authored-By: Brad King <brad.king@kitware.com>
Co-Authored-By: Tyler Yankee <tyler.yankee@kitware.com>
2026-05-05 19:57:54 -04:00
Matthew Woehlke 025fb87237 Diagnostics: Fix tests
Apply necessary manual updates to tests to account for changes made by
the introduction of the new diagnostic system. These mainly take three
forms. First, expected output changes that were not caught by the
automated changes made by the previous commit. Second, deprecation
warnings from -Wno-dev which are remedied by replacing uses thereof with
the new -Wno-author form. Third, manipulations of diagnostic state via
the old variables, which are replaced with use of the `cmake_diagnostic`
command.

We have not yet implemented backwards compatibility for the deprecated
`CMAKE_{WARN,ERROR}_DEPRECATED` variables. Once that is done, some of
the tests in the third category will likely reappear in some form.
2026-04-16 15:10:35 -04:00
Matthew Woehlke b0f9852990 Diagnostics: Update tests (automated)
Update expected test output to account for the new format of diagnostic
messages. These changes were applied entirely by `sed` using the
following commands:

  - `/Use -Wno-dev to suppress/s/-Wno-dev/-Wno-author/g`
  - `s/Warning [\\][(]dev[\\][)]/Warning \\(author\\)/g`
  - `s/CMake Deprecation Warning/CMake Warning \\(deprecated\\)/g`

This is not a complete fix, but covers a significant fraction of the
needed changes, and this commit is strictly automated changes.
2026-04-16 15:10:35 -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
Brad King 27b3755c61 Merge topic 'fix-cli-test'
7097e6712c Tests: Fix -Wno-error=dev test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11830
2026-03-19 11:15:13 -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
Brad King 6522790876 Merge topic 'test-RunCMake.CommandLine.d-tilde'
e746ac28fb Tests/RunCMake/CommandLine: Check tilde shell expansion more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11817
2026-03-15 09:21:04 -04:00
Brad King b47714d51e Merge topic 'test-RunCMake.CommandLine.d-tilde' into release-4.3
e746ac28fb Tests/RunCMake/CommandLine: Check tilde shell expansion more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11817
2026-03-15 09:21:02 -04:00
Brad King f51078308a Merge topic 'test-RunCMake.CommandLine.d-tilde' into release-4.2
e746ac28fb Tests/RunCMake/CommandLine: Check tilde shell expansion more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11817
2026-03-15 09:19:39 -04:00
Timo Röhling e746ac28fb Tests/RunCMake/CommandLine: Check tilde shell expansion more precisely
Revise the test from commit 01f92efeb0 (Restore expansion of leading '~'
as home directory in input paths, 2025-04-02, v4.0.1~12^2) to tolerate
`~` in the path to CMake's source or build tree.  If tilde `~` shell
expansion fails it can only occur at the beginning of a path component.
2026-03-14 07:15:23 -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
Martin Duffy 50535776c5 cmake -E cat: Read from stdin when no other args are given 2026-02-19 16:33:06 -05:00
Brad King 6db4676164 Tests: Comment intentional uses of UTF-8 in .cmake sources 2026-02-08 16:16:21 -05:00
Brad King d979f3df74 Merge topic 'fileapi-interface-sources'
b8af7837b3 fileapi: Add interfaceSources to the target codemodel replies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11655
2026-02-06 10:37:20 -05:00
Craig Scott b8af7837b3 fileapi: Add interfaceSources to the target codemodel replies
Fixes: #27489
2026-02-05 21:20:48 +09:00
AJIOB 39a3915022 cmd: implement json version output 2026-02-03 09:34:23 +03:00
Martin Duffy ef12ef1bd6 pvs-studio: Add support for linting with PVS-Studio 2026-01-16 11:25:59 -05:00
Kyle Edwards 394ab1fcfb cmake -E *sum: Add ability to read from stdin 2026-01-12 13:58:53 -05:00
Tyler Yankee b468b3baf2 trace: Print control structure "end" commands
Enhance `cmake --trace` (and related modes) by adding a backtrace for
the "end" command after "replaying" control structures.

Expand the unit test to include control structures.

Fixes: #27381
2026-01-07 09:21:15 -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
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
AJIOB 5de7a09e77 Tests/RunCMake: Match dots more precisely, part 3 2025-10-20 14:45:24 -04:00
AJIOB 62b112ee25 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-16 17:42:12 +03:00
AJIOB 06ccd15457 Tests/RunCMake: Match xxx.cmake file name more precisely 2025-10-16 17:42:12 +03:00
Hanna Rusakovich 638cf8f194 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-15 09:39:01 -04: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
Craig Scott 4315076f2e fileapi: Add codemodelVersion fields to target and directory objects
This will allow JSON schemas for these two types of files to describe the
version-specific content without requiring any outside information.

Fixes: #27031
2025-07-13 14:59:03 +10: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 be6c582ef6 Merge topic 'normalize-toolchain-file'
c393300e2b cmake: Restore acceptance of -DCMAKE_TOOLCHAIN_FILE=//... on non-Windows
cf0f46ed85 Tests/RunCMake/CommandLine: Simplify --toolchain cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10901
2025-06-24 10:42:36 -04:00
Brad King 9c3ce7852f Merge topic 'normalize-toolchain-file' into release-4.1
c393300e2b cmake: Restore acceptance of -DCMAKE_TOOLCHAIN_FILE=//... on non-Windows
cf0f46ed85 Tests/RunCMake/CommandLine: Simplify --toolchain cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10901
2025-06-24 10:42:34 -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 9d1a0fa256 Merge topic 'normalize-input-paths'
cd4e72ca08 Normalize PWD environment variable before using it

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10659
2025-04-16 09:37:09 -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
Felipe Torrezan c7d2a17253 IAR: Add support for C-STAT static analysis
The IAR platform offers an integrated static analysis tool named
IAR C-STAT.

Closes: #26844
2025-04-09 12:01:02 -04:00
Brad King 07970d3c64 Merge topic 'restore-home-tidle'
01f92efeb0 Restore expansion of leading '~' as home directory in input paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10580
2025-04-03 14:04:57 -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