summaryrefslogtreecommitdiffstats
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorRuslan Baratov <ruslan_baratov@yahoo.com>2019-03-27 19:36:51 (GMT)
committerRuslan Baratov <ruslan_baratov@yahoo.com>2019-03-27 19:39:02 (GMT)
commitdda01904587627a3d2bda5b684f7bef1e62596bb (patch)
tree34b65ed71c604b1aaf6e46e92d15b7cebb66d1b8 /Source/cmProjectCommand.cxx
parent390f14a24416f23801f5644eb51590f8317d35c7 (diff)
downloadCMake-dda01904587627a3d2bda5b684f7bef1e62596bb.zip
CMake-dda01904587627a3d2bda5b684f7bef1e62596bb.tar.gz
CMake-dda01904587627a3d2bda5b684f7bef1e62596bb.tar.bz2
project: Add variable CMAKE_PROJECT_INCLUDE
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r--Source/cmProjectCommand.cxx42
1 files changed, 31 insertions, 11 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 2fe9fe8..de5d1ed 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -319,21 +319,41 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
languages.emplace_back("CXX");
}
this->Makefile->EnableLanguage(languages, false);
- std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE";
- const char* include = this->Makefile->GetDefinition(extraInclude);
- if (include) {
- bool readit = this->Makefile->ReadDependentFile(include);
- if (!readit && !cmSystemTools::GetFatalErrorOccured()) {
- std::string m = "could not find file:\n"
- " ";
- m += include;
- this->SetError(m);
- return false;
- }
+
+ if (!this->IncludeByVariable("CMAKE_PROJECT_INCLUDE")) {
+ return false;
+ }
+
+ if (!this->IncludeByVariable("CMAKE_PROJECT_" + projectName + "_INCLUDE")) {
+ return false;
}
+
return true;
}
+bool cmProjectCommand::IncludeByVariable(const std::string& variable)
+{
+ const char* include = this->Makefile->GetDefinition(variable);
+ if (!include) {
+ return true;
+ }
+
+ const bool readit = this->Makefile->ReadDependentFile(include);
+ if (readit) {
+ return true;
+ }
+
+ if (cmSystemTools::GetFatalErrorOccured()) {
+ return true;
+ }
+
+ std::string m = "could not find file:\n"
+ " ";
+ m += include;
+ this->SetError(m);
+ return false;
+}
+
void cmProjectCommand::TopLevelCMakeVarCondSet(const char* const name,
const char* const value)
{