From f5b0a0fba458077e0531586f07ed2d01fb7f6259 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 23 May 2015 11:06:54 +0200 Subject: [PATCH] cmMakefile: Don't pop the directory listfile off the stack. Simplify the IssueMessage implementation. --- Source/cmMakefile.cxx | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 81960eb5f..71a8b6d26 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -260,18 +260,10 @@ void cmMakefile::IssueMessage(cmake::MessageType t, else { cmListFileContext lfc; - if(this->ListFileStack.empty()) - { - // We are not processing the project. Add the directory-level context. - lfc.FilePath = this->GetCurrentSourceDirectory(); - lfc.FilePath += "/CMakeLists.txt"; - } - else - { - // We are processing the project but are not currently executing a - // command. Add whatever context information we have. - lfc.FilePath = this->ListFileStack.back(); - } + // We are not currently executing a command. Add whatever context + // information we have. + lfc.FilePath = this->ListFileStack.back(); + if(!this->GetCMakeInstance()->GetIsInTryCompile()) { lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, @@ -535,12 +527,16 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); - return this->ReadListFile(listfile, noPolicyScope, false); + bool result = this->ReadListFile(listfile, noPolicyScope, false); + this->ListFileStack.pop_back(); + return result; } bool cmMakefile::ReadListFile(const char* listfile) { - return this->ReadListFile(listfile, true, false); + bool result = this->ReadListFile(listfile, true, false); + this->ListFileStack.pop_back(); + return result; } bool cmMakefile::ReadListFile(const char* listfile, @@ -577,8 +573,6 @@ bool cmMakefile::ReadListFile(const char* listfile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - this->ListFileStack.pop_back(); - if (res) { this->CheckForUnusedVariables();