summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-28 23:14:19 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-06-02 23:03:58 (GMT)
commitb68f2ea8ae26b23639df5978116375b47b4123c3 (patch)
tree18eed7a61c8e5cc00bc3f6138afb06530dab51f8
parent17e13f0a2de8dca416521cb5ad9775bf46030c83 (diff)
downloadCMake-b68f2ea8ae26b23639df5978116375b47b4123c3.zip
CMake-b68f2ea8ae26b23639df5978116375b47b4123c3.tar.gz
CMake-b68f2ea8ae26b23639df5978116375b47b4123c3.tar.bz2
cmMakefile: Add API for elseif to create backtrace.
-rw-r--r--Source/cmIfCommand.cxx7
-rw-r--r--Source/cmMakefile.cxx14
-rw-r--r--Source/cmMakefile.h1
3 files changed, 17 insertions, 5 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 3551f83..7c4792c 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff,
}
else
{
- // Place this call on the call stack.
- cmMakefileCall stack_manager(&mf, this->Functions[c], status);
- static_cast<void>(stack_manager);
-
// if trace is enabled, print the evaluated "elseif" statement
if(mf.GetCMakeInstance()->GetTrace())
{
@@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff,
{
std::string err = cmIfCommandError(expandedArguments);
err += errorString;
- mf.IssueMessage(messType, err);
+ cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
+ mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
if (messType == cmake::FATAL_ERROR)
{
cmSystemTools::SetFatalErrorOccured();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f09c8cb..9f2a1be 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -287,6 +287,20 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
}
//----------------------------------------------------------------------------
+cmListFileBacktrace
+cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
+{
+ cmListFileBacktrace backtrace(this->GetLocalGenerator());
+ backtrace.Append(lfc);
+ for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
+ i != this->CallStack.rend(); ++i)
+ {
+ backtrace.Append(*i->Context);
+ }
+ return backtrace;
+}
+
+//----------------------------------------------------------------------------
cmListFileContext cmMakefile::GetExecutionContext() const
{
return *this->CallStack.back().Context;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index efd73a1..29a7061 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -572,6 +572,7 @@ public:
* Get the current context backtrace.
*/
cmListFileBacktrace GetBacktrace() const;
+ cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const;
cmListFileContext GetExecutionContext() const;
/**