diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-03-12 21:59:42 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2014-06-05 16:44:19 (GMT) |
commit | 2a1b2d848693a3860f8e5f179b6c97f8c56abede (patch) | |
tree | 7987c9ba6b2be8fa15a6e7c9fe820ce512554f7e /Source/cmMakefile.cxx | |
parent | a08292059eba4fdded6643b225640ebf559b2dac (diff) | |
download | CMake-2a1b2d848693a3860f8e5f179b6c97f8c56abede.zip CMake-2a1b2d848693a3860f8e5f179b6c97f8c56abede.tar.gz CMake-2a1b2d848693a3860f8e5f179b6c97f8c56abede.tar.bz2 |
backtrace: Convert to local paths in IssueMessage
This is the only place we care show the FilePath to the user, so defer
the expensive relative path calculation until here.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b22ff87..630957f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -310,7 +310,12 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { // Collect context information. - cmListFileBacktrace backtrace; + cmLocalGenerator* localGen = this->GetLocalGenerator(); + if(this->CallStack.empty() && this->GetCMakeInstance()->GetIsInTryCompile()) + { + localGen = 0; + } + cmListFileBacktrace backtrace(localGen); if(!this->CallStack.empty()) { if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) @@ -335,11 +340,6 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.FilePath = this->ListFileStack.back(); } lfc.Line = 0; - if(!this->GetCMakeInstance()->GetIsInTryCompile()) - { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); - } backtrace.push_back(lfc); } @@ -350,14 +350,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, //---------------------------------------------------------------------------- cmListFileBacktrace cmMakefile::GetBacktrace() const { - cmListFileBacktrace backtrace; + cmListFileBacktrace backtrace(this->GetLocalGenerator()); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); i != this->CallStack.rend(); ++i) { - cmListFileContext lfc = *(*i).Context; - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, - cmLocalGenerator::HOME); - backtrace.push_back(lfc); + backtrace.push_back(*i->Context); } return backtrace; } @@ -1919,7 +1916,7 @@ void cmMakefile::CheckForUnused(const char* reason, if (this->WarnUnused && !this->VariableUsed(name)) { std::string path; - cmListFileBacktrace bt; + cmListFileBacktrace bt(this->GetLocalGenerator()); if (this->CallStack.size()) { const cmListFileContext* file = this->CallStack.back().Context; @@ -2870,7 +2867,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( this->GetHomeOutputDirectory())) { cmOStringStream msg; - cmListFileBacktrace bt; + cmListFileBacktrace bt(this->GetLocalGenerator()); cmListFileContext lfc; lfc.FilePath = filename; lfc.Line = line; |