1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
7 #include "cmExecutionStatus.h"
8 #include "cmMakefile.h"
10 struct cmListFileArgument;
12 void cmCommand::SetExecutionStatus(cmExecutionStatus* status)
14 this->Status = status;
15 this->Makefile = &status->GetMakefile();
18 bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
19 cmExecutionStatus& status)
21 std::vector<std::string> expandedArguments;
22 if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
23 // There was an error expanding arguments. It was already
24 // reported, so we can skip this command without error.
27 return this->InitialPass(expandedArguments, status);
30 void cmCommand::SetError(const std::string& e)
32 this->Status->SetError(e);
35 cmLegacyCommandWrapper::cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd)
36 : Command(std::move(cmd))
40 cmLegacyCommandWrapper::cmLegacyCommandWrapper(
41 cmLegacyCommandWrapper const& other)
42 : Command(other.Command->Clone())
46 cmLegacyCommandWrapper& cmLegacyCommandWrapper::operator=(
47 cmLegacyCommandWrapper const& other)
49 this->Command = other.Command->Clone();
53 bool cmLegacyCommandWrapper::operator()(
54 std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) const
56 auto cmd = this->Command->Clone();
57 cmd->SetExecutionStatus(&status);
58 return cmd->InvokeInitialPass(args, status);