diff options
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r-- | Source/cmProjectCommand.cxx | 42 |
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) { |