summaryrefslogtreecommitdiff
path: root/Source/cmBuildNameCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmBuildNameCommand.cxx')
-rw-r--r--Source/cmBuildNameCommand.cxx34
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 9d2c0c642..3e517dca4 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -2,24 +2,24 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmBuildNameCommand.h"
-#include "cmsys/RegularExpression.hxx"
#include <algorithm>
+#include "cmsys/RegularExpression.hxx"
+
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmBuildNameCommand
-bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmBuildNameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
- const char* cacheValue = this->Makefile->GetDefinition(args[0]);
+ cmMakefile& mf = status.GetMakefile();
+ const char* cacheValue = mf.GetDefinition(args[0]);
if (cacheValue) {
// do we need to correct the value?
cmsys::RegularExpression reg("[()/]");
@@ -28,33 +28,33 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
std::replace(cv.begin(), cv.end(), '/', '_');
std::replace(cv.begin(), cv.end(), '(', '_');
std::replace(cv.begin(), cv.end(), ')', '_');
- this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
- cmStateEnums::STRING);
+ mf.AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
+ cmStateEnums::STRING);
}
return true;
}
std::string buildname = "WinNT";
- if (this->Makefile->GetDefinition("UNIX")) {
- buildname = "";
+ if (mf.GetDefinition("UNIX")) {
+ buildname.clear();
cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname);
if (!buildname.empty()) {
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
- cmsys::RegularExpression reg(RegExp.c_str());
- if (reg.find(buildname.c_str())) {
+ cmsys::RegularExpression reg(RegExp);
+ if (reg.find(buildname)) {
buildname = reg.match(1) + "-" + reg.match(2);
}
}
}
std::string compiler = "${CMAKE_CXX_COMPILER}";
- this->Makefile->ExpandVariablesInString(compiler);
+ mf.ExpandVariablesInString(compiler);
buildname += "-";
buildname += cmSystemTools::GetFilenameName(compiler);
std::replace(buildname.begin(), buildname.end(), '/', '_');
std::replace(buildname.begin(), buildname.end(), '(', '_');
std::replace(buildname.begin(), buildname.end(), ')', '_');
- this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
- "Name of build.", cmStateEnums::STRING);
+ mf.AddCacheDefinition(args[0], buildname.c_str(), "Name of build.",
+ cmStateEnums::STRING);
return true;
}