diff options
author | Gabor Bencze <b.gabor98@gmail.com> | 2019-08-09 09:56:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-20 18:42:20 (GMT) |
commit | 07ea93de5447e0bc20b4632fa61d965c02876cc8 (patch) | |
tree | 0202088867f5f93d129626482ca8cb37f5ed9326 /Source/cmWriteFileCommand.cxx | |
parent | ca3b9186bb0830b26765bd764d5d9d69cf93e33d (diff) | |
download | CMake-07ea93de5447e0bc20b4632fa61d965c02876cc8.zip CMake-07ea93de5447e0bc20b4632fa61d965c02876cc8.tar.gz CMake-07ea93de5447e0bc20b4632fa61d965c02876cc8.tar.bz2 |
cmCommand refactor: cmWriteFileCommand
Diffstat (limited to 'Source/cmWriteFileCommand.cxx')
-rw-r--r-- | Source/cmWriteFileCommand.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 49dbf1a..63af65d 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -4,18 +4,17 @@ #include "cmsys/FStream.hxx" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSystemTools.h" #include "cm_sys_stat.h" -class cmExecutionStatus; - // cmLibraryCommand -bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmWriteFileCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() < 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } std::string message; @@ -33,10 +32,10 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, } } - if (!this->Makefile->CanIWriteThisFile(fileName)) { + if (!status.GetMakefile().CanIWriteThisFile(fileName)) { std::string e = "attempted to write a file: " + fileName + " into a source directory."; - this->SetError(e); + status.SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -68,7 +67,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, std::string error = "Internal CMake error when trying to open file: "; error += fileName; error += " for writing."; - this->SetError(error); + status.SetError(error); return false; } file << message << std::endl; |