diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 13 | ||||
-rw-r--r-- | Source/cmake.h | 8 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 11 |
3 files changed, 25 insertions, 7 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 169bf9e..013a87b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3733,7 +3733,7 @@ std::function<int()> cmake::BuildWorkflowStep( #endif int cmake::Workflow(const std::string& presetName, - WorkflowListPresets listPresets) + WorkflowListPresets listPresets, WorkflowFresh fresh) { #ifndef CMAKE_BOOTSTRAP this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); @@ -3815,10 +3815,13 @@ int cmake::Workflow(const std::string& presetName, if (!configurePreset) { return 1; } - steps.emplace_back( - stepNumber, "configure"_s, step.PresetName, - this->BuildWorkflowStep({ cmSystemTools::GetCMakeCommand(), - "--preset", step.PresetName })); + std::vector<std::string> args{ cmSystemTools::GetCMakeCommand(), + "--preset", step.PresetName }; + if (fresh == WorkflowFresh::Yes) { + args.emplace_back("--fresh"); + } + steps.emplace_back(stepNumber, "configure"_s, step.PresetName, + this->BuildWorkflowStep(args)); } break; case cmCMakePresetsGraph::WorkflowPreset::WorkflowStep::Type::Build: { auto const* buildPreset = this->FindPresetForWorkflow( diff --git a/Source/cmake.h b/Source/cmake.h index b3b9f19..3183577 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -607,7 +607,13 @@ public: No, Yes, }; - int Workflow(const std::string& presetName, WorkflowListPresets listPresets); + enum class WorkflowFresh + { + No, + Yes, + }; + int Workflow(const std::string& presetName, WorkflowListPresets listPresets, + WorkflowFresh fresh); void UnwatchUnusedCli(const std::string& var); void WatchUnusedCli(const std::string& var); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a6938bc..723932e 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -918,8 +918,10 @@ int do_workflow(int ac, char const* const* av) return -1; #else using WorkflowListPresets = cmake::WorkflowListPresets; + using WorkflowFresh = cmake::WorkflowFresh; std::string presetName; auto listPresets = WorkflowListPresets::No; + auto fresh = WorkflowFresh::No; using CommandArgument = cmCommandLineArgument<bool(std::string const& value)>; @@ -932,6 +934,11 @@ int do_workflow(int ac, char const* const* av) 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; @@ -968,6 +975,8 @@ int do_workflow(int ac, char const* const* av) "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; @@ -982,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 } |