summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx32
1 files changed, 27 insertions, 5 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index b754b72..723932e 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
}