summaryrefslogtreecommitdiffstats
path: root/Source/cmCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-04-07 18:18:32 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-07-21 07:25:32 (GMT)
commit015001aaf138119f4825e3c84c0845c5127f9088 (patch)
tree5f881f7df3823cad5d3ec7c603a5aac3f3a51c35 /Source/cmCommand.cxx
parent1eebc2956321c2e7da00a5d35e207bedb899c804 (diff)
downloadCMake-015001aaf138119f4825e3c84c0845c5127f9088.zip
CMake-015001aaf138119f4825e3c84c0845c5127f9088.tar.gz
CMake-015001aaf138119f4825e3c84c0845c5127f9088.tar.bz2
cmState: Hold commands by value
Diffstat (limited to 'Source/cmCommand.cxx')
-rw-r--r--Source/cmCommand.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx
index 99bdd1e..0c2734e 100644
--- a/Source/cmCommand.cxx
+++ b/Source/cmCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCommand.h"
+#include <utility>
+
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
@@ -29,3 +31,29 @@ void cmCommand::SetError(const std::string& e)
{
this->Status->SetError(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
+{
+ auto cmd = this->Command->Clone();
+ cmd->SetExecutionStatus(&status);
+ return cmd->InvokeInitialPass(args, status);
+}