|
@@ -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);
|