diff options
Diffstat (limited to 'Source/cmCommand.cxx')
-rw-r--r-- | Source/cmCommand.cxx | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx index d349c91..0c2734e 100644 --- a/Source/cmCommand.cxx +++ b/Source/cmCommand.cxx @@ -2,11 +2,19 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCommand.h" +#include <utility> + +#include "cmExecutionStatus.h" #include "cmMakefile.h" -class cmExecutionStatus; struct cmListFileArgument; +void cmCommand::SetExecutionStatus(cmExecutionStatus* status) +{ + this->Status = status; + this->Makefile = &status->GetMakefile(); +} + bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args, cmExecutionStatus& status) { @@ -19,15 +27,33 @@ bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args, return this->InitialPass(expandedArguments, status); } -const char* cmCommand::GetError() +void cmCommand::SetError(const std::string& e) { - if (this->Error.empty()) { - return "unknown error."; - } - return this->Error.c_str(); + this->Status->SetError(e); } -void cmCommand::SetError(const std::string& e) +cmLegacyCommandWrapper::cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd) + : Command(std::move(cmd)) +{ +} + +cmLegacyCommandWrapper::cmLegacyCommandWrapper( + cmLegacyCommandWrapper const& other) + : Command(other.Command->Clone()) +{ +} + +cmLegacyCommandWrapper& cmLegacyCommandWrapper::operator=( + cmLegacyCommandWrapper const& other) +{ + this->Command = other.Command->Clone(); + return *this; +} + +bool cmLegacyCommandWrapper::operator()( + std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) const { - this->Error = e; + auto cmd = this->Command->Clone(); + cmd->SetExecutionStatus(&status); + return cmd->InvokeInitialPass(args, status); } |