diff options
author | Gabor Bencze <b.gabor98@gmail.com> | 2019-08-21 17:53:29 (GMT) |
---|---|---|
committer | Gabor Bencze <b.gabor98@gmail.com> | 2019-08-25 12:29:25 (GMT) |
commit | 524d72151449acf5d76e55172174552b83a74f61 (patch) | |
tree | 2e0eb4cdb54690fe731451b5d3715443bc3eb841 /Source/cmUseMangledMesaCommand.cxx | |
parent | 2a1be178de5f12d55ec486609f4512e6b2b9d168 (diff) | |
download | CMake-524d72151449acf5d76e55172174552b83a74f61.zip CMake-524d72151449acf5d76e55172174552b83a74f61.tar.gz CMake-524d72151449acf5d76e55172174552b83a74f61.tar.bz2 |
cmCommand refactor: cmUseMangledMesaCommand
Diffstat (limited to 'Source/cmUseMangledMesaCommand.cxx')
-rw-r--r-- | Source/cmUseMangledMesaCommand.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 3d83760..cfc00e8 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -5,26 +5,30 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" +#include "cmExecutionStatus.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; +namespace { +void CopyAndFullPathMesaHeader(const std::string& source, + const std::string& outdir); +} -bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmUseMangledMesaCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { // expected two arguments: // argument one: the full path to gl_mangle.h // argument two : directory for output of edited headers if (args.size() != 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } const std::string& inputDir = args[0]; std::string glh = cmStrCat(inputDir, "/gl.h"); if (!cmSystemTools::FileExists(glh)) { std::string e = cmStrCat("Bad path to Mesa, could not find: ", glh, ' '); - this->SetError(e); + status.SetError(e); return false; } const std::string& destDir = args[1]; @@ -37,14 +41,15 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, cmSystemTools::MakeDirectory(destDir); for (std::string const& f : files) { std::string path = cmStrCat(inputDir, '/', f); - this->CopyAndFullPathMesaHeader(path, destDir); + CopyAndFullPathMesaHeader(path, destDir); } return true; } -void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( - const std::string& source, const std::string& outdir) +namespace { +void CopyAndFullPathMesaHeader(const std::string& source, + const std::string& outdir) { std::string dir; std::string file; @@ -96,3 +101,4 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile); cmSystemTools::RemoveFile(tempOutputFile); } +} |