summaryrefslogtreecommitdiff
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-05-24 23:18:28 +0300
committerPavel Solodovnikov <hellyeahdominate@gmail.com>2017-05-26 19:50:11 +0300
commit86dc86dd6c66a6d61234efcddddddf466a6597d2 (patch)
treef7fcf0d9852d4d66b362a9c0fba67fd9d42661e8 /Source/cmProjectCommand.cxx
parent76bdb4076277cda0e68e1d80cdf715020eab5a7a (diff)
downloadcmake-86dc86dd6c66a6d61234efcddddddf466a6597d2.tar.gz
Add const-reference qualifications
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r--Source/cmProjectCommand.cxx41
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index d47a047a15..d72c7909cf 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -22,11 +22,14 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("PROJECT called with incorrect number of arguments");
return false;
}
- this->Makefile->SetProjectName(args[0]);
- std::string bindir = args[0];
+ std::string const& projectName = args[0];
+
+ this->Makefile->SetProjectName(projectName);
+
+ std::string bindir = projectName;
bindir += "_BINARY_DIR";
- std::string srcdir = args[0];
+ std::string srcdir = projectName;
srcdir += "_SOURCE_DIR";
this->Makefile->AddCacheDefinition(
@@ -44,7 +47,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddDefinition(srcdir,
this->Makefile->GetCurrentSourceDirectory());
- this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
+ this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
// Set the CMAKE_PROJECT_NAME variable to be the highest-level
// project name in the tree. If there are two project commands
@@ -54,10 +57,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
// will work.
if (!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") ||
(this->Makefile->IsRootMakefile())) {
- this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
- this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(),
- "Value Computed by CMake",
- cmStateEnums::STATIC);
+ this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName.c_str());
+ this->Makefile->AddCacheDefinition(
+ "CMAKE_PROJECT_NAME", projectName.c_str(), "Value Computed by CMake",
+ cmStateEnums::STATIC);
}
bool haveVersion = false;
@@ -163,19 +166,19 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
}
std::string vv;
- vv = args[0] + "_VERSION";
+ vv = projectName + "_VERSION";
this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str());
this->Makefile->AddDefinition(vv, vs.c_str());
- vv = args[0] + "_VERSION_MAJOR";
+ vv = projectName + "_VERSION_MAJOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]);
this->Makefile->AddDefinition(vv, vb[0]);
- vv = args[0] + "_VERSION_MINOR";
+ vv = projectName + "_VERSION_MINOR";
this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]);
this->Makefile->AddDefinition(vv, vb[1]);
- vv = args[0] + "_VERSION_PATCH";
+ vv = projectName + "_VERSION_PATCH";
this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]);
this->Makefile->AddDefinition(vv, vb[2]);
- vv = args[0] + "_VERSION_TWEAK";
+ vv = projectName + "_VERSION_TWEAK";
this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]);
this->Makefile->AddDefinition(vv, vb[3]);
} else if (cmp0048 != cmPolicies::OLD) {
@@ -186,11 +189,11 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
vv.push_back("PROJECT_VERSION_MINOR");
vv.push_back("PROJECT_VERSION_PATCH");
vv.push_back("PROJECT_VERSION_TWEAK");
- vv.push_back(args[0] + "_VERSION");
- vv.push_back(args[0] + "_VERSION_MAJOR");
- vv.push_back(args[0] + "_VERSION_MINOR");
- vv.push_back(args[0] + "_VERSION_PATCH");
- vv.push_back(args[0] + "_VERSION_TWEAK");
+ vv.push_back(projectName + "_VERSION");
+ vv.push_back(projectName + "_VERSION_MAJOR");
+ vv.push_back(projectName + "_VERSION_MINOR");
+ vv.push_back(projectName + "_VERSION_PATCH");
+ vv.push_back(projectName + "_VERSION_TWEAK");
std::string vw;
for (std::vector<std::string>::iterator i = vv.begin(); i != vv.end();
++i) {
@@ -234,7 +237,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
languages.push_back("CXX");
}
this->Makefile->EnableLanguage(languages, false);
- std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
+ std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE";
const char* include = this->Makefile->GetDefinition(extraInclude);
if (include) {
bool readit = this->Makefile->ReadDependentFile(include);