diff options
author | Brad King <brad.king@kitware.com> | 2022-10-27 13:43:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-10-27 13:43:39 (GMT) |
commit | ab8801157917c574236ee472e864408405cb83cc (patch) | |
tree | 20ebd7ca40df3f65f53f209a2887b835a3f3f14f /Source/cmakemain.cxx | |
parent | 5eab7ea84bf2549eb14877fd148f54ecfb9e1b75 (diff) | |
parent | 7ecbe324b0ef02f63676f8431dbbbe8b4217f64f (diff) | |
download | CMake-ab8801157917c574236ee472e864408405cb83cc.zip CMake-ab8801157917c574236ee472e864408405cb83cc.tar.gz CMake-ab8801157917c574236ee472e864408405cb83cc.tar.bz2 |
Merge topic 'cmake-presets-workflow-arguments'
7ecbe324b0 cmake --workflow: add --fresh option
7d9aa0f00c cmake::Workflow: Refactor to use enum class argument
322193afcd cmake --workflow: print usage and exit on unrecognized argument
70aef29427 cmake --workflow: print usage message
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7825
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r-- | Source/cmakemain.cxx | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 928c1ba..43bebc1 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -917,8 +917,11 @@ 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; + using WorkflowFresh = cmake::WorkflowFresh; std::string presetName; - bool listPresets = false; + auto listPresets = WorkflowListPresets::No; + auto fresh = WorkflowFresh::No; using CommandArgument = cmCommandLineArgument<bool(std::string const& value)>; @@ -927,7 +930,15 @@ 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; + } }, + CommandArgument{ "--fresh", CommandArgument::Values::Zero, + [&fresh](const std::string&) -> bool { + fresh = WorkflowFresh::Yes; + return true; + } }, }; std::vector<std::string> inputArgs; @@ -949,14 +960,25 @@ int do_workflow(int ac, char const* const* av) } if (!(matched && parsed)) { if (!matched) { + presetName.clear(); + listPresets = WorkflowListPresets::No; std::cerr << "Unknown argument " << arg << std::endl; } break; } } - if (presetName.empty() && !listPresets) { - std::cerr << "TODO: Usage\n"; + if (presetName.empty() && listPresets == WorkflowListPresets::No) { + /* clang-format off */ + std::cerr << + "Usage: cmake --workflow [options]\n" + "Options:\n" + " --preset <preset> = Workflow preset to execute.\n" + " --list-presets = List available workflow presets.\n" + " --fresh = Configure a fresh build tree, removing any " + "existing cache file.\n" + ; + /* clang-format on */ return 1; } @@ -969,7 +991,7 @@ int do_workflow(int ac, char const* const* av) cmakemainProgressCallback(msg, prog, &cm); }); - return cm.Workflow(presetName, listPresets); + return cm.Workflow(presetName, listPresets, fresh); #endif } |