summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
-rw-r--r--Source/cmCustomCommand.cxx4
-rw-r--r--Source/cmExportBuildFileGenerator.cxx1
-rw-r--r--Source/cmGeneratorExpression.cxx2
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h5
-rw-r--r--Source/cmListFileCache.cxx18
-rw-r--r--Source/cmListFileCache.h17
-rw-r--r--Source/cmMakefile.cxx23
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTest.cxx2
-rw-r--r--Source/cmake.cxx5
-rw-r--r--Source/cmake.h2
13 files changed, 66 insertions, 22 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index a7f6b49..64b67c9 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -137,7 +137,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
this->Makefile->GetHomeOutputDirectory()))
{
cmOStringStream msg;
- cmListFileBacktrace bt;
+ cmListFileBacktrace bt(this->Makefile->GetLocalGenerator());
cmListFileContext lfc;
lfc.FilePath = this->FileName;
lfc.Line = this->FileLine;
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index ae702e5..c161eb6 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -17,6 +17,7 @@
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
+ : Backtrace(NULL)
{
this->HaveComment = false;
this->EscapeOldStyle = true;
@@ -73,7 +74,8 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
Comment(comment?comment:""),
WorkingDirectory(workingDirectory?workingDirectory:""),
EscapeAllowMakeVars(false),
- EscapeOldStyle(true)
+ EscapeOldStyle(true),
+ Backtrace(NULL)
{
this->EscapeOldStyle = true;
this->EscapeAllowMakeVars = false;
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 6c8ebb6..30a52d4 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -18,6 +18,7 @@
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
+ : Backtrace(NULL)
{
this->Makefile = 0;
this->ExportSet = 0;
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 9a74569..dea57e0 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -35,7 +35,7 @@ cmGeneratorExpression::Parse(std::string const& input)
{
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
- this->Backtrace ? *this->Backtrace : cmListFileBacktrace(),
+ this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL),
input));
}
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 531a471..75a84cb 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -34,7 +34,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
- Content(content), TransitivePropertiesOnly(false)
+ Content(content), Backtrace(NULL), TransitivePropertiesOnly(false)
{
Initialize();
}
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index eb76d7f..0ffb860 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -22,6 +22,11 @@ class cmTarget;
//----------------------------------------------------------------------------
struct cmGeneratorExpressionContext
{
+ cmGeneratorExpressionContext()
+ : Backtrace(NULL)
+ {
+ }
+
cmListFileBacktrace Backtrace;
std::set<cmTarget*> DependTargets;
std::set<cmTarget const*> AllTargets;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 34781d3..705666d 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -12,6 +12,7 @@
#include "cmListFileCache.h"
#include "cmListFileLexer.h"
+#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmVersion.h"
@@ -408,6 +409,23 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
}
//----------------------------------------------------------------------------
+void cmListFileBacktrace::MakeRelative()
+{
+ if (this->Relative)
+ {
+ return;
+ }
+ for (cmListFileBacktrace::iterator i = this->begin();
+ i != this->end(); ++i)
+ {
+ i->FilePath = this->LocalGenerator->Convert(i->FilePath,
+ cmLocalGenerator::HOME);
+ }
+ this->Relative = true;
+}
+
+
+//----------------------------------------------------------------------------
std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
{
os << lfc.FilePath;
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index bede25e..2ca9b8e 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -14,6 +14,8 @@
#include "cmStandardIncludes.h"
+class cmLocalGenerator;
+
/** \class cmListFileCache
* \brief A class to cache list file contents.
*
@@ -66,7 +68,20 @@ struct cmListFileFunction: public cmListFileContext
std::vector<cmListFileArgument> Arguments;
};
-class cmListFileBacktrace: public std::vector<cmListFileContext> {};
+class cmListFileBacktrace: public std::vector<cmListFileContext>
+{
+ public:
+ cmListFileBacktrace(cmLocalGenerator* localGen)
+ : LocalGenerator(localGen)
+ , Relative(localGen ? false : true)
+ {
+ }
+
+ void MakeRelative();
+ private:
+ cmLocalGenerator* LocalGenerator;
+ bool Relative;
+};
struct cmListFile
{
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;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4b5dc7a..59cc14c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -87,10 +87,12 @@ class cmTargetInternals
{
public:
cmTargetInternals()
+ : Backtrace(NULL)
{
this->PolicyWarnedCMP0022 = false;
}
cmTargetInternals(cmTargetInternals const&)
+ : Backtrace(NULL)
{
this->PolicyWarnedCMP0022 = false;
}
@@ -1324,9 +1326,10 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
: "plain");
s << "The uses of the " << sigString << " signature are here:\n";
std::set<std::string> emitted;
- for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
+ for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin();
it != sigs.end(); ++it)
{
+ it->MakeRelative();
cmListFileBacktrace::const_iterator i = it->begin();
if(i != it->end())
{
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 464ad60..ff5d411 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -17,11 +17,11 @@
//----------------------------------------------------------------------------
cmTest::cmTest(cmMakefile* mf)
+ : Backtrace(mf->GetBacktrace())
{
this->Makefile = mf;
this->OldStyle = true;
this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
- this->Backtrace = this->Makefile->GetBacktrace();
}
//----------------------------------------------------------------------------
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 45d3c21..e3bebbd 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2562,8 +2562,11 @@ static bool cmakeCheckStampList(const char* stampList)
//----------------------------------------------------------------------------
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& backtrace)
+ cmListFileBacktrace const& bt)
{
+ cmListFileBacktrace backtrace = bt;
+ backtrace.MakeRelative();
+
cmOStringStream msg;
bool isError = false;
// Construct the message header.
diff --git a/Source/cmake.h b/Source/cmake.h
index 47e25d5..2d04902 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -360,7 +360,7 @@ class cmake
/** Display a message to the user. */
void IssueMessage(cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& backtrace = cmListFileBacktrace());
+ cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL));
///! run the --build option
int Build(const std::string& dir,
const std::string& target,