From 99f4edb4e40501625788c5c1e2db1bb3bbe5c3ba Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Thu, 22 Jun 2006 15:31:19 -0400 Subject: [PATCH] ENH: DIsplay the list file stack when displaying errors --- Source/cmMakefile.cxx | 20 ++++++++++++++++++-- Source/cmMakefile.h | 7 ++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1c8e72a9d..5251b4de8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -267,7 +267,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff) cmOStringStream error; error << "Error in cmake code at\n" << lff.FilePath << ":" << lff.Line << ":\n" - << rm->GetError(); + << rm->GetError() << std::endl + << "Current CMake stack: " << this->GetListFileStack().c_str(); cmSystemTools::Error(error.str().c_str()); return false; } @@ -283,7 +284,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff) cmOStringStream error; error << "Error in cmake code at\n" << lff.FilePath << ":" << lff.Line << ":\n" - << usedCommand->GetError(); + << usedCommand->GetError() << std::endl + << "Current CMake stack: " << this->GetListFileStack().c_str(); cmSystemTools::Error(error.str().c_str()); result = false; if ( this->GetCMakeInstance()->GetScriptMode() ) @@ -2743,3 +2745,17 @@ std::vector *cmMakefile::GetTests() return &this->Tests; } +std::string cmMakefile::GetListFileStack() +{ + std::string tmp; + for (std::deque::iterator i = this->ListFileStack.begin(); + i != this->ListFileStack.end(); ++i) + { + if (i != this->ListFileStack.begin()) + { + tmp += ";"; + } + tmp += *i; + } + return tmp; +} diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 172ab7ae2..b502c4de7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -538,7 +538,12 @@ public: ///! When the file changes cmake will be re-run from the build system. void AddCMakeDependFile(const char* file) { this->ListFiles.push_back(file);} - + + /** + * Get the list file stack as a string + */ + std::string GetListFileStack(); + /** * Get the vector of files created by this makefile */