diff options
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r-- | Source/cmakemain.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 15e3190..a6938bc 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -917,8 +917,9 @@ int do_workflow(int ac, char const* const* av) std::cerr << "This cmake does not support --workflow\n"; return -1; #else + using WorkflowListPresets = cmake::WorkflowListPresets; std::string presetName; - bool listPresets = false; + auto listPresets = WorkflowListPresets::No; using CommandArgument = cmCommandLineArgument<bool(std::string const& value)>; @@ -927,7 +928,10 @@ int do_workflow(int ac, char const* const* av) CommandArgument{ "--preset", CommandArgument::Values::One, CommandArgument::setToValue(presetName) }, CommandArgument{ "--list-presets", CommandArgument::Values::Zero, - CommandArgument::setToTrue(listPresets) } + [&listPresets](const std::string&) -> bool { + listPresets = WorkflowListPresets::Yes; + return true; + } }, }; std::vector<std::string> inputArgs; @@ -950,14 +954,14 @@ int do_workflow(int ac, char const* const* av) if (!(matched && parsed)) { if (!matched) { presetName.clear(); - listPresets = false; + listPresets = WorkflowListPresets::No; std::cerr << "Unknown argument " << arg << std::endl; } break; } } - if (presetName.empty() && !listPresets) { + if (presetName.empty() && listPresets == WorkflowListPresets::No) { /* clang-format off */ std::cerr << "Usage: cmake --workflow [options]\n" |