summaryrefslogtreecommitdiffstats
path: root/Source/cmVariableWatchCommand.cxx
diff options
context:
space:
mode:
authorGabor Bencze <b.gabor98@gmail.com>2019-08-09 09:54:15 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-20 18:42:20 (GMT)
commitca3b9186bb0830b26765bd764d5d9d69cf93e33d (patch)
tree10285ef8aab9c39e02159395de4f2972f47a9832 /Source/cmVariableWatchCommand.cxx
parentb1acc711f4cdf62a850c09a85256482db2e2af2e (diff)
downloadCMake-ca3b9186bb0830b26765bd764d5d9d69cf93e33d.zip
CMake-ca3b9186bb0830b26765bd764d5d9d69cf93e33d.tar.gz
CMake-ca3b9186bb0830b26765bd764d5d9d69cf93e33d.tar.bz2
cmCommand refactor: cmVariableWatchCommand
Diffstat (limited to 'Source/cmVariableWatchCommand.cxx')
-rw-r--r--Source/cmVariableWatchCommand.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 83a774d..db23efd 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVariableWatchCommand.h"
+#include <memory>
#include <sstream>
#include <utility>
@@ -119,11 +120,11 @@ private:
std::shared_ptr<Impl const> Action;
};
-bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmVariableWatchCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("must be called with at least one argument.");
+ status.SetError("must be called with at least one argument.");
return false;
}
std::string const& variable = args[0];
@@ -134,7 +135,7 @@ bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
if (variable == "CMAKE_CURRENT_LIST_FILE") {
std::ostringstream ostr;
ostr << "cannot be set on the variable: " << variable;
- this->SetError(ostr.str());
+ status.SetError(ostr.str());
return false;
}
@@ -143,13 +144,14 @@ bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
data->InCallback = false;
data->Command = command;
- if (!this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch(
+ if (!status.GetMakefile().GetCMakeInstance()->GetVariableWatch()->AddWatch(
variable, cmVariableWatchCommandVariableAccessed, data,
deleteVariableWatchCallbackData)) {
deleteVariableWatchCallbackData(data);
return false;
}
- this->Makefile->AddFinalAction(FinalAction(this->Makefile, variable));
+ status.GetMakefile().AddFinalAction(
+ FinalAction(&status.GetMakefile(), variable));
return true;
}