diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-18 12:50:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-18 13:29:18 (GMT) |
commit | 5c201f1ee6cc19e0f1871048a6a6af9056c5780f (patch) | |
tree | 4d2e3916837cddb4f6192727addaaf9b3596684f /Source/cmMakefile.cxx | |
parent | 0d9555779d7bd2a8d068f5b9af431bcf9673453a (diff) | |
download | CMake-5c201f1ee6cc19e0f1871048a6a6af9056c5780f.zip CMake-5c201f1ee6cc19e0f1871048a6a6af9056c5780f.tar.gz CMake-5c201f1ee6cc19e0f1871048a6a6af9056c5780f.tar.bz2 |
cmMakefile: Remove duplication in ReadListFile.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0211591..38e94e2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -542,8 +542,34 @@ bool cmMakefile::ReadListFile(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - return this->ReadListFileInternal(filename_in, external_in, - noPolicyScope, requireProjectCommand); + std::string currentParentFile + = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); + std::string currentFile + = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + + bool res = this->ReadListFileInternal(filename_in, external_in, + noPolicyScope, requireProjectCommand); + + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); + this->AddDefinition("CMAKE_CURRENT_LIST_DIR", + cmSystemTools::GetFilenamePath(currentFile).c_str()); + this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); + this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); + + this->ListFileStack.pop_back(); + + if (res) + { + // Check for unused variables + this->CheckForUnusedVariables(); + } + + return res; } bool cmMakefile::ReadListFileInternal(const char* filename_in, @@ -551,13 +577,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, bool noPolicyScope, bool requireProjectCommand) { - std::string currentParentFile - = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); - std::string currentFile - = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename_in); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - const char* external = 0; std::string external_abs; @@ -604,15 +623,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, cmListFile cacheFile; if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) ) { - // pop the listfile off the stack - this->ListFileStack.pop_back(); - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); return false; } // add this list file to the list of dependencies @@ -651,20 +661,6 @@ bool cmMakefile::ReadListFileInternal(const char* filename_in, this->EnforceDirectoryLevelRules(); } - this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); - this->AddDefinition("CMAKE_CURRENT_LIST_DIR", - cmSystemTools::GetFilenamePath(currentFile).c_str()); - this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - - // pop the listfile off the stack - this->ListFileStack.pop_back(); - - // Check for unused variables - this->CheckForUnusedVariables(); - return true; } |