summaryrefslogtreecommitdiffstats
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-01 14:48:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-04-01 14:49:02 (GMT)
commit3e129d71bc12a325c0548aaaea24470cd172470b (patch)
treed084c28fcf436d2529807f81ca31711b0384cbbe /Source/cmProjectCommand.cxx
parent29802ed27227fe91be1d531d6e894e4efbbb3d11 (diff)
parent7d19b3091d7d2982a0d6b2b4408011efbb56f167 (diff)
downloadCMake-3e129d71bc12a325c0548aaaea24470cd172470b.zip
CMake-3e129d71bc12a325c0548aaaea24470cd172470b.tar.gz
CMake-3e129d71bc12a325c0548aaaea24470cd172470b.tar.bz2
Merge topic 'project-include'
7d19b3091d Release note for CMAKE_PROJECT_INCLUDE variable dda0190458 project: Add variable CMAKE_PROJECT_INCLUDE 390f14a244 Test ProjectInclude: Add NONE to avoid enabling languages Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3155
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)
{