diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-06-21 18:07:40 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-06-21 18:10:51 (GMT) |
commit | 3404f8a081a03441c6747de50f2155ae28115c07 (patch) | |
tree | 429339e36678ae3b95891ceae7d0242c6879e807 /Source | |
parent | a1858136c28326212d15cfd0a4412281f46b9cb0 (diff) | |
download | CMake-3404f8a081a03441c6747de50f2155ae28115c07.zip CMake-3404f8a081a03441c6747de50f2155ae28115c07.tar.gz CMake-3404f8a081a03441c6747de50f2155ae28115c07.tar.bz2 |
cmMakefile: Move ListFile parsing responsibility out of internal method.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 58 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 |
2 files changed, 41 insertions, 21 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 62d4c66..32767a3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -533,39 +533,52 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), + curSrc == this->GetHomeDirectory(), this)) + { + return false; + } + this->PushPolicyBarrier(); - bool result = this->ReadListFile(filename, - curSrc == this->GetHomeDirectory()); + this->ReadListFile(listFile, filenametoread); this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); this->EnforceDirectoryLevelRules(); - return result; + return true; } bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); + std::string filenametoread = + cmSystemTools::CollapseFullPath(filename, + this->GetCurrentSourceDirectory()); + + this->ListFileStack.push_back(filenametoread); + + cmListFile listFile; + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) + { + return false; + } IncludeScope incScope(this, noPolicyScope); - bool result = this->ReadListFile(filename, false); + this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) { incScope.Quiet(); } - return result; + return true; } bool cmMakefile::ReadListFile(const char* filename) { - this->PushPolicyBarrier(); - bool result = this->ReadListFile(filename, false); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->ListFileStack.pop_back(); - return result; -} - -bool cmMakefile::ReadListFile(const char* filename, - bool requireProjectCommand) -{ std::string filenametoread = cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); @@ -573,12 +586,21 @@ bool cmMakefile::ReadListFile(const char* filename, this->ListFileStack.push_back(filenametoread); cmListFile listFile; - if (!listFile.ParseFile(filenametoread.c_str(), - requireProjectCommand, this)) + if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { return false; } + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filenametoread); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->ListFileStack.pop_back(); + return true; +} + +void cmMakefile::ReadListFile(cmListFile const& listFile, + std::string const& filenametoread) +{ // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -625,8 +647,6 @@ bool cmMakefile::ReadListFile(const char* filename, this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 24b4bd0..271cfd6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -914,8 +914,8 @@ private: cmState::Snapshot StateSnapshot; - bool ReadListFile(const char* filename, - bool requireProjectCommand); + void ReadListFile(cmListFile const& listFile, + const std::string& filenametoread); bool ParseDefineFlag(std::string const& definition, bool remove); |