16 Commits
Author SHA1 Message Date
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
Maximilian Sander 2a9cde8b6e presets: Add defined listings with unavailable reasons
Add workflow and per-type defined values to cmake --list-presets.
Each -defined value lists every non-hidden preset of the selected type
and explains why unavailable presets cannot be used. The defined value
is an alias for configure-defined.

Support --list-presets=defined in cmake build and workflow modes,
ctest, and cpack. Propagate configure preset unavailability to
dependent build, test, package, and workflow presets.

Fixes: #28016, #26118
2026-08-19 16:47:50 +02:00
Richard b1f15344c9 Presets: Clarify workflow step error messages
Report both the workflow step type and preset name when workflow
preset validation or execution fails.  This disambiguates workflows
where configure, build, test, and package steps share the same preset
name.

Update the workflow preset RunCMake expectations.
2026-07-31 10:44:57 -06:00
Maximilian Sander b1d80531dc presets: Diagnose non-string workflow step types 2026-07-29 18:20:23 +02:00
Maximilian Sander 394ce2ebe6 presets: Diagnose workflow configure preset mismatches 2026-07-28 00:41:41 +02: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
Kyle Williams 6e89bd5d55 Presets: Forward presets-file to workflow steps
- Forward the '--presets-file <file>' arguments to each workflow step.
- Ensure tests do not auto-set CMakePresets.json
- Fix typos in test names

Fixes: 27932
2026-07-11 23:38:06 -05:00
Tyler Yankee 54be7af178 Tests: Remove empty CMakePresets *.cmake files
When adding a presets test case, the per-case `.cmake` files are
sometimes not necessary to exercise the test logic. Relax the inclusion
of such files and remove all empty placeholders.

Note that some non-empty `CMakePresets/Trace-*.cmake` files are also
removed; they only include other empty files, and nothing in the test
case assertions (trace outputs / stderr) exercises the include
statements themselves.
2026-06-01 16:31:58 -04:00
Tyler Yankee e16767d962 presets: Fix command help for --presets-file
Amends commit 95edd93948 (presets: Support loading from arbitrary file,
2026-03-18).
2026-05-19 11:49:26 -04:00
Tyler Yankee 95edd93948 presets: Support loading from arbitrary file
Allow CMake, CTest, and CPack to read presets from a path given by
command-line argument instead of always requiring `CMakePresets.json`
or `CMakeUserPresets.json` in the source tree. This makes the presets
feature more extensible to cases in which the user doesn't have access
to the presets defined in the source tree (e.g., if the source tree is
not writable).

For now, there is no equivalent implementation of such an option in the
`cmake-gui`, nor for the recent presets functionality implemented in
`ctest_configure` and `ctest_build`.

Fixes: #27329
2026-04-30 08:04:26 -04:00
Tyler Yankee ef95ae2e45 cmake --workflow: Improve errors when no preset is specified
Add a better error message and tests to verify.
2026-03-19 10:24:33 -04:00
Kevin Tolle b80aa1d3a3 preset: Easier command line interface for Workflow Presets
A positional option allows 'cmake --workflow --preset <preset>' to be
shortened to 'cmake --workflow <preset>'.

Fixes: #26270
2024-10-05 16:08:44 +10:00
Martin Duffy 19305afd8a presets: Improve JSON parser and error messages 2023-03-29 10:41:19 -04:00
Kyle Edwards 7ecbe324b0 cmake --workflow: add --fresh option
Fixes: #24073
2022-10-26 12:01:25 -04:00
Kyle Edwards 322193afcd cmake --workflow: print usage and exit on unrecognized argument
Issue: #24073
2022-10-26 12:00:57 -04:00
Kyle Edwards 374d82bbcd cmake: Add --workflow mode
Fixes: #23118
2022-09-27 11:09:06 -04:00