cmake --workflow: Improve errors when no preset is specified

Add a better error message and tests to verify.
This commit is contained in:
Tyler Yankee
2026-03-19 10:24:33 -04:00
parent af78be98c5
commit ef95ae2e45
6 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -991,7 +991,8 @@ int do_workflow(int ac, char const* const* av)
cmCommandLineArgument<bool(std::string const& value)>;
std::vector<CommandArgument> arguments = {
CommandArgument{ "--preset", CommandArgument::Values::One,
CommandArgument{ "--preset", "No preset specified for --preset",
CommandArgument::Values::One,
CommandArgument::setToValue(presetName) },
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
[&listPresets](std::string const&) -> bool {
@@ -0,0 +1 @@
^CMake Error: No preset specified for --preset
@@ -0,0 +1 @@
^CMake Error: No preset specified for --preset
@@ -81,6 +81,8 @@ unset(CMakeUserPresets_FILE)
unset(CMakePresets_ASSETS)
run_cmake_workflow_presets(ListPresets --list-presets)
run_cmake_command(PresetsNoArg-workflow ${CMAKE_COMMAND} "--workflow" "--preset")
run_cmake_command(PresetsNoArgEq-workflow ${CMAKE_COMMAND} "--workflow" "--preset=")
run_cmake_workflow_presets(InvalidOption -DINVALID_OPTION)
set(RunCMake_TEST_NO_CLEAN TRUE)