Commit Graph
330 Commits
Author SHA1 Message Date
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
Brad King fa201d3cff Tests: Fix cmake --trace=json-v1 test expectation for integer time
Extend the `time` field check from commit c829f0cfca (trace: Add time
and stack level to JSON output format, 2020-01-20, v3.17.0-rc1~105^2) to
accept a timestamp that happens to be formatted as an exact integer.
2026-07-02 08:07:40 -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
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