Merge topic 'dev/backtrace-performance'

86be733f cmGeneratorExpression: Add workaround for Borland compiler
3495ab0a tests: update unused variable test expected output
2a1b2d84 backtrace: Convert to local paths in IssueMessage
a0829205 genex: remove the need for backtraces
efc20569 cmake: remove dummy backtraces for IssueMessage
d46c650d cmMakefile: return a backtrace
This commit is contained in:
Brad King 2014-06-09 10:28:44 -04:00 committed by CMake Topic Stage
commit a0861931ea
35 changed files with 236 additions and 226 deletions

@ -137,7 +137,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
this->Makefile->GetHomeOutputDirectory())) this->Makefile->GetHomeOutputDirectory()))
{ {
cmOStringStream msg; cmOStringStream msg;
cmListFileBacktrace bt; cmListFileBacktrace bt(this->Makefile->GetLocalGenerator());
cmListFileContext lfc; cmListFileContext lfc;
lfc.FilePath = this->FileName; lfc.FilePath = this->FileName;
lfc.Line = this->FileLine; lfc.Line = this->FileLine;

@ -386,15 +386,17 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
e << "The dependency target \"" << dependee_name e << "The dependency target \"" << dependee_name
<< "\" of target \"" << depender->GetName() << "\" does not exist."; << "\" of target \"" << depender->GetName() << "\" does not exist.";
cmListFileBacktrace nullBacktrace;
cmListFileBacktrace const* backtrace = cmListFileBacktrace const* backtrace =
depender->GetUtilityBacktrace(dependee_name); depender->GetUtilityBacktrace(dependee_name);
if(!backtrace) if(backtrace)
{ {
backtrace = &nullBacktrace; cm->IssueMessage(messageType, e.str(), *backtrace);
}
else
{
cm->IssueMessage(messageType, e.str());
} }
cm->IssueMessage(messageType, e.str(), *backtrace);
} }
} }

@ -17,6 +17,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand() cmCustomCommand::cmCustomCommand()
: Backtrace(NULL)
{ {
this->HaveComment = false; this->HaveComment = false;
this->EscapeOldStyle = true; this->EscapeOldStyle = true;
@ -33,7 +34,7 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
WorkingDirectory(r.WorkingDirectory), WorkingDirectory(r.WorkingDirectory),
EscapeAllowMakeVars(r.EscapeAllowMakeVars), EscapeAllowMakeVars(r.EscapeAllowMakeVars),
EscapeOldStyle(r.EscapeOldStyle), EscapeOldStyle(r.EscapeOldStyle),
Backtrace(new cmListFileBacktrace(*r.Backtrace)) Backtrace(r.Backtrace)
{ {
} }
@ -54,11 +55,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
this->EscapeAllowMakeVars = r.EscapeAllowMakeVars; this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
this->EscapeOldStyle = r.EscapeOldStyle; this->EscapeOldStyle = r.EscapeOldStyle;
this->ImplicitDepends = r.ImplicitDepends; this->ImplicitDepends = r.ImplicitDepends;
this->Backtrace = r.Backtrace;
cmsys::auto_ptr<cmListFileBacktrace>
newBacktrace(new cmListFileBacktrace(*r.Backtrace));
delete this->Backtrace;
this->Backtrace = newBacktrace.release();
return *this; return *this;
} }
@ -78,20 +75,19 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
WorkingDirectory(workingDirectory?workingDirectory:""), WorkingDirectory(workingDirectory?workingDirectory:""),
EscapeAllowMakeVars(false), EscapeAllowMakeVars(false),
EscapeOldStyle(true), EscapeOldStyle(true),
Backtrace(new cmListFileBacktrace) Backtrace(NULL)
{ {
this->EscapeOldStyle = true; this->EscapeOldStyle = true;
this->EscapeAllowMakeVars = false; this->EscapeAllowMakeVars = false;
if(mf) if(mf)
{ {
mf->GetBacktrace(*this->Backtrace); this->Backtrace = mf->GetBacktrace();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCustomCommand::~cmCustomCommand() cmCustomCommand::~cmCustomCommand()
{ {
delete this->Backtrace;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -166,7 +162,7 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
{ {
return *this->Backtrace; return this->Backtrace;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -13,8 +13,8 @@
#define cmCustomCommand_h #define cmCustomCommand_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmListFileCache.h"
class cmMakefile; class cmMakefile;
class cmListFileBacktrace;
/** \class cmCustomCommand /** \class cmCustomCommand
* \brief A class to encapsulate a custom command * \brief A class to encapsulate a custom command
@ -88,7 +88,7 @@ private:
std::string WorkingDirectory; std::string WorkingDirectory;
bool EscapeAllowMakeVars; bool EscapeAllowMakeVars;
bool EscapeOldStyle; bool EscapeOldStyle;
cmListFileBacktrace* Backtrace; cmListFileBacktrace Backtrace;
ImplicitDependsList ImplicitDepends; ImplicitDependsList ImplicitDepends;
}; };

@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false)
{ {
} }

@ -18,6 +18,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator() cmExportBuildFileGenerator::cmExportBuildFileGenerator()
: Backtrace(NULL)
{ {
this->Makefile = 0; this->Makefile = 0;
this->ExportSet = 0; this->ExportSet = 0;

@ -45,7 +45,7 @@ public:
void SetMakefile(cmMakefile *mf) { void SetMakefile(cmMakefile *mf) {
this->Makefile = mf; this->Makefile = mf;
this->Makefile->GetBacktrace(this->Backtrace); this->Backtrace = this->Makefile->GetBacktrace();
} }
protected: protected:

@ -377,8 +377,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES"; const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
const char *input = target->GetProperty(propName); const char *input = target->GetProperty(propName);
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
std::string dirs = cmGeneratorExpression::Preprocess( std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories, tei->InterfaceIncludeDirectories,

@ -57,10 +57,9 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
return std::string(); return std::string();
} }
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(
tgt->GetName(), tgt->GetName(),
propName, 0, 0); propName, 0, 0);

@ -3270,14 +3270,13 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName,
bool inputIsContent bool inputIsContent
) )
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression outputGe(lfbt); cmGeneratorExpression outputGe(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge
= outputGe.Parse(outputExpr); = outputGe.Parse(outputExpr);
cmGeneratorExpression conditionGe(lfbt); cmGeneratorExpression conditionGe(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
= conditionGe.Parse(condition); = conditionGe.Parse(condition);

@ -24,7 +24,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGeneratorExpression::cmGeneratorExpression( cmGeneratorExpression::cmGeneratorExpression(
cmListFileBacktrace const& backtrace): cmListFileBacktrace const* backtrace):
Backtrace(backtrace) Backtrace(backtrace)
{ {
} }
@ -33,10 +33,18 @@ cmGeneratorExpression::cmGeneratorExpression(
cmsys::auto_ptr<cmCompiledGeneratorExpression> cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input) cmGeneratorExpression::Parse(std::string const& input)
{ {
#if !defined(__BORLANDC__)
return cmsys::auto_ptr<cmCompiledGeneratorExpression>( return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression( new cmCompiledGeneratorExpression(
this->Backtrace, this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL),
input)); input));
#else
cmListFileBacktrace emptyBacktrace(NULL);
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
this->Backtrace ? *this->Backtrace : emptyBacktrace,
input));
#endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -41,7 +41,7 @@ class cmGeneratorExpression
{ {
public: public:
/** Construct. */ /** Construct. */
cmGeneratorExpression(cmListFileBacktrace const& backtrace); cmGeneratorExpression(cmListFileBacktrace const* backtrace = NULL);
~cmGeneratorExpression(); ~cmGeneratorExpression();
cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(
@ -70,7 +70,7 @@ private:
cmGeneratorExpression(const cmGeneratorExpression &); cmGeneratorExpression(const cmGeneratorExpression &);
void operator=(const cmGeneratorExpression &); void operator=(const cmGeneratorExpression &);
cmListFileBacktrace const& Backtrace; cmListFileBacktrace const* Backtrace;
}; };
class cmCompiledGeneratorExpression class cmCompiledGeneratorExpression

@ -23,6 +23,25 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
cmGeneratorExpressionDAGChecker *parent) cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property), : Parent(parent), Target(target), Property(property),
Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false) Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false)
{
Initialize();
}
//----------------------------------------------------------------------------
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const std::string &target,
const std::string &property,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
Content(content), Backtrace(NULL), TransitivePropertiesOnly(false)
{
Initialize();
}
//----------------------------------------------------------------------------
void
cmGeneratorExpressionDAGChecker::Initialize()
{ {
const cmGeneratorExpressionDAGChecker *top = this; const cmGeneratorExpressionDAGChecker *top = this;
const cmGeneratorExpressionDAGChecker *p = this->Parent; const cmGeneratorExpressionDAGChecker *p = this->Parent;
@ -43,11 +62,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
#undef TEST_TRANSITIVE_PROPERTY_METHOD #undef TEST_TRANSITIVE_PROPERTY_METHOD
{ {
std::map<std::string, std::set<std::string> >::const_iterator it std::map<std::string, std::set<std::string> >::const_iterator it
= top->Seen.find(target); = top->Seen.find(this->Target);
if (it != top->Seen.end()) if (it != top->Seen.end())
{ {
const std::set<std::string> &propSet = it->second; const std::set<std::string> &propSet = it->second;
const std::set<std::string>::const_iterator i = propSet.find(property); const std::set<std::string>::const_iterator i
= propSet.find(this->Property);
if (i != propSet.end()) if (i != propSet.end())
{ {
this->CheckResult = ALREADY_SEEN; this->CheckResult = ALREADY_SEEN;
@ -55,7 +75,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
} }
} }
const_cast<cmGeneratorExpressionDAGChecker *>(top) const_cast<cmGeneratorExpressionDAGChecker *>(top)
->Seen[target].insert(property); ->Seen[this->Target].insert(this->Property);
} }
} }

@ -46,6 +46,10 @@ struct cmGeneratorExpressionDAGChecker
const std::string &property, const std::string &property,
const GeneratorExpressionContent *content, const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent); cmGeneratorExpressionDAGChecker *parent);
cmGeneratorExpressionDAGChecker(const std::string &target,
const std::string &property,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent);
enum Result { enum Result {
DAG, DAG,
@ -76,6 +80,7 @@ struct cmGeneratorExpressionDAGChecker
private: private:
Result CheckGraph() const; Result CheckGraph() const;
void Initialize();
private: private:
const cmGeneratorExpressionDAGChecker * const Parent; const cmGeneratorExpressionDAGChecker * const Parent;

@ -115,7 +115,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
} }
cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace();
cmGeneratorExpression contentGE(lfbt); cmGeneratorExpression contentGE(&lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression
= contentGE.Parse(inputContent); = contentGE.Parse(inputContent);

@ -809,7 +809,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets,
cmGeneratorExpressionDAGChecker *dagChecker, cmGeneratorExpressionDAGChecker *dagChecker,
const std::string &interfacePropertyName) const std::string &interfacePropertyName)
{ {
cmGeneratorExpression ge(context->Backtrace); cmGeneratorExpression ge(&context->Backtrace);
std::string sep; std::string sep;
std::string depString; std::string depString;
@ -1196,7 +1196,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{ {
if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName) if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)
{ {
cmGeneratorExpression ge(context->Backtrace); cmGeneratorExpression ge(&context->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
std::string result = cge->Evaluate(context->Makefile, std::string result = cge->Evaluate(context->Makefile,
context->Config, context->Config,

@ -22,6 +22,11 @@ class cmTarget;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct cmGeneratorExpressionContext struct cmGeneratorExpressionContext
{ {
cmGeneratorExpressionContext()
: Backtrace(NULL)
{
}
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
std::set<cmTarget*> DependTargets; std::set<cmTarget*> DependTargets;
std::set<cmTarget const*> AllTargets; std::set<cmTarget const*> AllTargets;

@ -259,12 +259,10 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
std::vector<std::string>& result, std::vector<std::string>& result,
bool excludeImported) bool excludeImported)
{ {
cmListFileBacktrace lfbt;
if (const char* dirs = if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"))
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs) cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf, ->Evaluate(mf,
config, false, headTarget, config, false, headTarget,
@ -278,7 +276,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
if (const char* dirs = if (const char* dirs =
depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES"))
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs) cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(mf, ->Evaluate(mf,
config, false, headTarget, config, false, headTarget,
@ -457,8 +455,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
return false; return false;
} }
cmListFileBacktrace lfbt; cmGeneratorExpressionDAGChecker dagChecker(
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
this->GetName(), this->GetName(),
"SYSTEM_INCLUDE_DIRECTORIES", 0, 0); "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
@ -470,7 +467,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
it = this->Target->GetSystemIncludeDirectories().begin(); it = this->Target->GetSystemIncludeDirectories().begin();
it != this->Target->GetSystemIncludeDirectories().end(); ++it) it != this->Target->GetSystemIncludeDirectories().end(); ++it)
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(*it) cmSystemTools::ExpandListArgument(ge.Parse(*it)
->Evaluate(this->Makefile, ->Evaluate(this->Makefile,
config, false, this->Target, config, false, this->Target,
@ -808,7 +805,7 @@ cmTargetTraceDependencies
{ {
// Transform command names that reference targets built in this // Transform command names that reference targets built in this
// project to corresponding target-level dependencies. // project to corresponding target-level dependencies.
cmGeneratorExpression ge(cc.GetBacktrace()); cmGeneratorExpression ge(&cc.GetBacktrace());
// Add target-level dependencies referenced by generator expressions. // Add target-level dependencies referenced by generator expressions.
std::set<cmTarget*> targets; std::set<cmTarget*> targets;

@ -1282,8 +1282,7 @@ void cmGlobalGenerator::Generate()
if(!this->GenerateCPackPropertiesFile()) if(!this->GenerateCPackPropertiesFile())
{ {
this->GetCMakeInstance()->IssueMessage( this->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR, "Could not write CPack properties file.", cmake::FATAL_ERROR, "Could not write CPack properties file.");
cmListFileBacktrace());
} }
for (std::map<std::string, cmExportBuildFileGenerator*>::iterator for (std::map<std::string, cmExportBuildFileGenerator*>::iterator
@ -1294,8 +1293,7 @@ void cmGlobalGenerator::Generate()
&& !cmSystemTools::GetErrorOccuredFlag()) && !cmSystemTools::GetErrorOccuredFlag())
{ {
this->GetCMakeInstance() this->GetCMakeInstance()
->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.", ->IssueMessage(cmake::FATAL_ERROR, "Could not write export file.");
cmListFileBacktrace());
return; return;
} }
} }
@ -1324,8 +1322,7 @@ void cmGlobalGenerator::Generate()
{ {
w << " " << *iter << "\n"; w << " " << *iter << "\n";
} }
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str());
cmListFileBacktrace());
} }
this->CMakeInstance->UpdateProgress("Generating done", -1); this->CMakeInstance->UpdateProgress("Generating done", -1);
@ -1525,8 +1522,7 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
if(ti == this->GeneratorTargets.end()) if(ti == this->GeneratorTargets.end())
{ {
this->CMakeInstance->IssueMessage( this->CMakeInstance->IssueMessage(
cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!", cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!");
cmListFileBacktrace());
return 0; return 0;
} }
return ti->second; return ti->second;

@ -12,6 +12,7 @@
#include "cmInstallFilesGenerator.h" #include "cmInstallFilesGenerator.h"
#include "cmGeneratorExpression.h" #include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -84,8 +85,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
Indent const& indent) Indent const& indent)
{ {
std::vector<std::string> files; std::vector<std::string> files;
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
for(std::vector<std::string>::const_iterator i = this->Files.begin(); for(std::vector<std::string>::const_iterator i = this->Files.begin();
i != this->Files.end(); ++i) i != this->Files.end(); ++i)
{ {

@ -32,9 +32,8 @@ cmInstalledFile::~cmInstalledFile()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
{ {
cmListFileBacktrace backtrace; cmListFileBacktrace backtrace = mf->GetBacktrace();
mf->GetBacktrace(backtrace); cmGeneratorExpression ge(&backtrace);
cmGeneratorExpression ge(backtrace);
this->Name = name; this->Name = name;
this->NameExpression = ge.Parse(name).release(); this->NameExpression = ge.Parse(name).release();
@ -70,9 +69,8 @@ void cmInstalledFile::SetProperty(cmMakefile const* mf,
void cmInstalledFile::AppendProperty(cmMakefile const* mf, void cmInstalledFile::AppendProperty(cmMakefile const* mf,
const std::string& prop, const char* value, bool /*asString*/) const std::string& prop, const char* value, bool /*asString*/)
{ {
cmListFileBacktrace backtrace; cmListFileBacktrace backtrace = mf->GetBacktrace();
mf->GetBacktrace(backtrace); cmGeneratorExpression ge(&backtrace);
cmGeneratorExpression ge(backtrace);
Property& property = this->Properties[prop]; Property& property = this->Properties[prop];
property.ValueExpressions.push_back(ge.Parse(value).release()); property.ValueExpressions.push_back(ge.Parse(value).release());

@ -12,6 +12,7 @@
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmListFileLexer.h" #include "cmListFileLexer.h"
#include "cmLocalGenerator.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmVersion.h" #include "cmVersion.h"
@ -407,6 +408,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) std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
{ {

@ -14,6 +14,8 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmLocalGenerator;
/** \class cmListFileCache /** \class cmListFileCache
* \brief A class to cache list file contents. * \brief A class to cache list file contents.
* *
@ -66,7 +68,20 @@ struct cmListFileFunction: public cmListFileContext
std::vector<cmListFileArgument> Arguments; 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 struct cmListFile
{ {

@ -310,14 +310,19 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const std::string const& text) const
{ {
// Collect context information. // 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(!this->CallStack.empty())
{ {
if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR))
{ {
this->CallStack.back().Status->SetNestedError(true); this->CallStack.back().Status->SetNestedError(true);
} }
this->GetBacktrace(backtrace); backtrace = this->GetBacktrace();
} }
else else
{ {
@ -335,11 +340,6 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
lfc.FilePath = this->ListFileStack.back(); lfc.FilePath = this->ListFileStack.back();
} }
lfc.Line = 0; lfc.Line = 0;
if(!this->GetCMakeInstance()->GetIsInTryCompile())
{
lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
cmLocalGenerator::HOME);
}
backtrace.push_back(lfc); backtrace.push_back(lfc);
} }
@ -348,21 +348,15 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const cmListFileBacktrace cmMakefile::GetBacktrace() const
{ {
if(this->CallStack.empty()) cmListFileBacktrace backtrace(this->GetLocalGenerator());
{
return false;
}
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
i != this->CallStack.rend(); ++i) i != this->CallStack.rend(); ++i)
{ {
cmListFileContext lfc = *(*i).Context; backtrace.push_back(*i->Context);
lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
cmLocalGenerator::HOME);
backtrace.push_back(lfc);
} }
return true; return backtrace;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1745,8 +1739,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
before ? this->IncludeDirectoriesEntries.begin() before ? this->IncludeDirectoriesEntries.begin()
: this->IncludeDirectoriesEntries.end(); : this->IncludeDirectoriesEntries.end();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
cmValueWithOrigin entry(incString, lfbt); cmValueWithOrigin entry(incString, lfbt);
this->IncludeDirectoriesEntries.insert(position, entry); this->IncludeDirectoriesEntries.insert(position, entry);
@ -1923,7 +1916,7 @@ void cmMakefile::CheckForUnused(const char* reason,
if (this->WarnUnused && !this->VariableUsed(name)) if (this->WarnUnused && !this->VariableUsed(name))
{ {
std::string path; std::string path;
cmListFileBacktrace bt; cmListFileBacktrace bt(this->GetLocalGenerator());
if (this->CallStack.size()) if (this->CallStack.size())
{ {
const cmListFileContext* file = this->CallStack.back().Context; const cmListFileContext* file = this->CallStack.back().Context;
@ -2874,7 +2867,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
this->GetHomeOutputDirectory())) this->GetHomeOutputDirectory()))
{ {
cmOStringStream msg; cmOStringStream msg;
cmListFileBacktrace bt; cmListFileBacktrace bt(this->GetLocalGenerator());
cmListFileContext lfc; cmListFileContext lfc;
lfc.FilePath = filename; lfc.FilePath = filename;
lfc.Line = line; lfc.Line = line;
@ -4013,8 +4006,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
{ {
return; return;
} }
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
this->IncludeDirectoriesEntries.push_back( this->IncludeDirectoriesEntries.push_back(
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
@ -4026,8 +4018,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
{ {
return; return;
} }
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
return; return;
} }
@ -4038,8 +4029,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
{ {
return; return;
} }
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt); cmValueWithOrigin entry(value, lfbt);
this->CompileDefinitionsEntries.push_back(entry); this->CompileDefinitionsEntries.push_back(entry);
return; return;
@ -4070,24 +4060,21 @@ void cmMakefile::AppendProperty(const std::string& prop,
{ {
if (prop == "INCLUDE_DIRECTORIES") if (prop == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
this->IncludeDirectoriesEntries.push_back( this->IncludeDirectoriesEntries.push_back(
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if (prop == "COMPILE_OPTIONS") if (prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
this->CompileOptionsEntries.push_back( this->CompileOptionsEntries.push_back(
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if (prop == "COMPILE_DEFINITIONS") if (prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->GetBacktrace();
this->GetBacktrace(lfbt);
this->CompileDefinitionsEntries.push_back( this->CompileDefinitionsEntries.push_back(
cmValueWithOrigin(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;

@ -655,7 +655,7 @@ public:
/** /**
* Get the current context backtrace. * Get the current context backtrace.
*/ */
bool GetBacktrace(cmListFileBacktrace& backtrace) const; cmListFileBacktrace GetBacktrace() const;
/** /**
* Get the vector of files created by this makefile * Get the vector of files created by this makefile

@ -137,8 +137,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->Makefile->GetProperty this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES")) ("ADDITIONAL_MAKE_CLEAN_FILES"))
{ {
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(additional_clean_files); ge.Parse(additional_clean_files);

@ -87,10 +87,12 @@ class cmTargetInternals
{ {
public: public:
cmTargetInternals() cmTargetInternals()
: Backtrace(NULL)
{ {
this->PolicyWarnedCMP0022 = false; this->PolicyWarnedCMP0022 = false;
} }
cmTargetInternals(cmTargetInternals const&) cmTargetInternals(cmTargetInternals const&)
: Backtrace(NULL)
{ {
this->PolicyWarnedCMP0022 = false; this->PolicyWarnedCMP0022 = false;
} }
@ -366,7 +368,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
} }
// Save the backtrace of target construction. // Save the backtrace of target construction.
this->Makefile->GetBacktrace(this->Internal->Backtrace); this->Internal->Backtrace = this->Makefile->GetBacktrace();
if (!this->IsImported()) if (!this->IsImported())
{ {
@ -443,7 +445,7 @@ void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
{ {
if(this->Utilities.insert(u).second && makefile) if(this->Utilities.insert(u).second && makefile)
{ {
makefile->GetBacktrace(UtilityBacktraces[u]); UtilityBacktraces.insert(std::make_pair(u, makefile->GetBacktrace()));
} }
} }
@ -710,11 +712,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
this->DebugSourcesDone = true; this->DebugSourcesDone = true;
} }
cmListFileBacktrace lfbt; cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
"SOURCES", 0, 0);
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
this->GetName(),
"SOURCES", 0, 0);
std::set<std::string> uniqueSrcs; std::set<std::string> uniqueSrcs;
bool contextDependentDirectSources = processSources(this, bool contextDependentDirectSources = processSources(this,
@ -739,7 +738,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
continue; continue;
} }
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value); ge.Parse(it->Value);
std::string targetResult = cge->Evaluate(this->Makefile, config, std::string targetResult = cge->Evaluate(this->Makefile, config,
@ -758,7 +757,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
// TARGET_PROPERTY expression. // TARGET_PROPERTY expression.
sourceGenex = "$<$<BOOL:" + it->Value + ">:" + sourceGenex + ">"; sourceGenex = "$<$<BOOL:" + it->Value + ">:" + sourceGenex + ">";
} }
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
sourceGenex); sourceGenex);
@ -910,9 +909,8 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
{ {
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true; this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
@ -948,9 +946,8 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
{ {
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true; this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
@ -1084,9 +1081,8 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
{ {
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true; this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
@ -1206,11 +1202,10 @@ void cmTarget::GetDirectLinkLibraries(const std::string& config,
const char *prop = this->GetProperty("LINK_LIBRARIES"); const char *prop = this->GetProperty("LINK_LIBRARIES");
if (prop) if (prop)
{ {
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), this->GetName(),
"LINK_LIBRARIES", 0, 0); "LINK_LIBRARIES", 0, 0);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
@ -1241,11 +1236,10 @@ void cmTarget::GetInterfaceLinkLibraries(const std::string& config,
const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES");
if (prop) if (prop)
{ {
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), this->GetName(),
"INTERFACE_LINK_LIBRARIES", 0, 0); "INTERFACE_LINK_LIBRARIES", 0, 0);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
@ -1306,8 +1300,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
ret = false; ret = false;
} }
} }
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
this->TLLCommands.push_back(std::make_pair(signature, lfbt)); this->TLLCommands.push_back(std::make_pair(signature, lfbt));
return ret; return ret;
} }
@ -1333,9 +1326,10 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
: "plain"); : "plain");
s << "The uses of the " << sigString << " signature are here:\n"; s << "The uses of the " << sigString << " signature are here:\n";
std::set<std::string> emitted; 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 != sigs.end(); ++it)
{ {
it->MakeRelative();
cmListFileBacktrace::const_iterator i = it->begin(); cmListFileBacktrace::const_iterator i = it->begin();
if(i != it->end()) if(i != it->end())
{ {
@ -1796,9 +1790,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
} }
if(prop == "INCLUDE_DIRECTORIES") if(prop == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->IncludeDirectoriesEntries); deleteAndClear(this->Internal->IncludeDirectoriesEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->IncludeDirectoriesEntries.push_back( this->Internal->IncludeDirectoriesEntries.push_back(
@ -1807,9 +1800,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
} }
if(prop == "COMPILE_OPTIONS") if(prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileOptionsEntries); deleteAndClear(this->Internal->CompileOptionsEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileOptionsEntries.push_back( this->Internal->CompileOptionsEntries.push_back(
@ -1818,9 +1810,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
} }
if(prop == "COMPILE_FEATURES") if(prop == "COMPILE_FEATURES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileFeaturesEntries); deleteAndClear(this->Internal->CompileFeaturesEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileFeaturesEntries.push_back( this->Internal->CompileFeaturesEntries.push_back(
@ -1829,9 +1820,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
} }
if(prop == "COMPILE_DEFINITIONS") if(prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileDefinitionsEntries); deleteAndClear(this->Internal->CompileDefinitionsEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileDefinitionsEntries.push_back( this->Internal->CompileDefinitionsEntries.push_back(
@ -1849,8 +1839,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
if (prop == "LINK_LIBRARIES") if (prop == "LINK_LIBRARIES")
{ {
this->Internal->LinkImplementationPropertyEntries.clear(); this->Internal->LinkImplementationPropertyEntries.clear();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt); cmValueWithOrigin entry(value, lfbt);
this->Internal->LinkImplementationPropertyEntries.push_back(entry); this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return; return;
@ -1866,9 +1855,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
return; return;
} }
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->SourceEntries.clear(); this->Internal->SourceEntries.clear();
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
@ -1901,36 +1889,32 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
} }
if(prop == "INCLUDE_DIRECTORIES") if(prop == "INCLUDE_DIRECTORIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->IncludeDirectoriesEntries.push_back( this->Internal->IncludeDirectoriesEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(prop == "COMPILE_OPTIONS") if(prop == "COMPILE_OPTIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->CompileOptionsEntries.push_back( this->Internal->CompileOptionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(prop == "COMPILE_FEATURES") if(prop == "COMPILE_FEATURES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->CompileFeaturesEntries.push_back( this->Internal->CompileFeaturesEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
} }
if(prop == "COMPILE_DEFINITIONS") if(prop == "COMPILE_DEFINITIONS")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->CompileDefinitionsEntries.push_back( this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return; return;
@ -1945,8 +1929,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
} }
if (prop == "LINK_LIBRARIES") if (prop == "LINK_LIBRARIES")
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt); cmValueWithOrigin entry(value, lfbt);
this->Internal->LinkImplementationPropertyEntries.push_back(entry); this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return; return;
@ -1962,9 +1945,8 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
return; return;
} }
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(&lfbt);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge)); new cmTargetInternals::TargetPropertyEntry(cge));
@ -2030,7 +2012,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
void cmTarget::InsertInclude(const cmValueWithOrigin &entry, void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
bool before) bool before)
{ {
cmGeneratorExpression ge(entry.Backtrace); cmGeneratorExpression ge(&entry.Backtrace);
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->IncludeDirectoriesEntries.begin() = before ? this->Internal->IncludeDirectoriesEntries.begin()
@ -2044,7 +2026,7 @@ void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
bool before) bool before)
{ {
cmGeneratorExpression ge(entry.Backtrace); cmGeneratorExpression ge(&entry.Backtrace);
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->CompileOptionsEntries.begin() = before ? this->Internal->CompileOptionsEntries.begin()
@ -2057,7 +2039,7 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry)
{ {
cmGeneratorExpression ge(entry.Backtrace); cmGeneratorExpression ge(&entry.Backtrace);
this->Internal->CompileDefinitionsEntries.push_back( this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
@ -2098,14 +2080,13 @@ static void processIncludeDirectories(cmTarget const* tgt,
} }
} }
std::string usedIncludes; std::string usedIncludes;
cmListFileBacktrace lfbt;
for(std::vector<std::string>::iterator for(std::vector<std::string>::iterator
li = entryIncludes.begin(); li != entryIncludes.end(); ++li) li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
{ {
std::string targetName = (*it)->TargetName; std::string targetName = (*it)->TargetName;
std::string evaluatedTargetName; std::string evaluatedTargetName;
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(targetName); ge.Parse(targetName);
evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0);
@ -2238,10 +2219,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
{ {
std::vector<std::string> includes; std::vector<std::string> includes;
std::set<std::string> uniqueIncludes; std::set<std::string> uniqueIncludes;
cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
this->GetName(),
"INCLUDE_DIRECTORIES", 0, 0); "INCLUDE_DIRECTORIES", 0, 0);
std::vector<std::string> debugProperties; std::vector<std::string> debugProperties;
@ -2284,7 +2263,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
continue; continue;
} }
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value); ge.Parse(it->Value);
std::string result = cge->Evaluate(this->Makefile, config, std::string result = cge->Evaluate(this->Makefile, config,
@ -2303,7 +2282,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
// TARGET_PROPERTY expression. // TARGET_PROPERTY expression.
includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">"; includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
} }
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
includeGenex); includeGenex);
@ -2332,7 +2311,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
libDir = frameworkCheck.match(1); libDir = frameworkCheck.match(1);
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str()); ge.Parse(libDir.c_str());
this->Internal this->Internal
@ -2446,10 +2425,9 @@ void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
{ {
return; return;
} }
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), this->GetName(),
"AUTOUIC_OPTIONS", 0, 0); "AUTOUIC_OPTIONS", 0, 0);
cmSystemTools::ExpandListArgument(ge.Parse(prop) cmSystemTools::ExpandListArgument(ge.Parse(prop)
@ -2466,11 +2444,9 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
const std::string& config) const const std::string& config) const
{ {
std::set<std::string> uniqueOptions; std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
this->GetName(), "COMPILE_OPTIONS", 0, 0);
"COMPILE_OPTIONS", 0, 0);
std::vector<std::string> debugProperties; std::vector<std::string> debugProperties;
const char *debugProp = const char *debugProp =
@ -2512,7 +2488,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
continue; continue;
} }
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value); ge.Parse(it->Value);
std::string targetResult = cge->Evaluate(this->Makefile, config, std::string targetResult = cge->Evaluate(this->Makefile, config,
@ -2531,7 +2507,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
// TARGET_PROPERTY expression. // TARGET_PROPERTY expression.
optionGenex = "$<$<BOOL:" + it->Value + ">:" + optionGenex + ">"; optionGenex = "$<$<BOOL:" + it->Value + ">:" + optionGenex + ">";
} }
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
optionGenex); optionGenex);
@ -2578,11 +2554,9 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
const std::string& config) const const std::string& config) const
{ {
std::set<std::string> uniqueOptions; std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
this->GetName(), "COMPILE_DEFINITIONS", 0, 0);
"COMPILE_DEFINITIONS", 0, 0);
std::vector<std::string> debugProperties; std::vector<std::string> debugProperties;
const char *debugProp = const char *debugProp =
@ -2624,7 +2598,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
continue; continue;
} }
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value); ge.Parse(it->Value);
std::string targetResult = cge->Evaluate(this->Makefile, config, std::string targetResult = cge->Evaluate(this->Makefile, config,
@ -2643,7 +2617,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
// TARGET_PROPERTY expression. // TARGET_PROPERTY expression.
defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">"; defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">";
} }
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
defsGenex); defsGenex);
@ -2671,7 +2645,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
} }
case cmPolicies::OLD: case cmPolicies::OLD:
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp); ge.Parse(configProp);
this->Internal this->Internal
@ -2726,10 +2700,8 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
const std::string& config) const const std::string& config) const
{ {
std::set<std::string> uniqueFeatures; std::set<std::string> uniqueFeatures;
cmListFileBacktrace lfbt;
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
this->GetName(),
"COMPILE_FEATURES", "COMPILE_FEATURES",
0, 0); 0, 0);
@ -2773,7 +2745,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
continue; continue;
} }
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(it->Value); ge.Parse(it->Value);
std::string targetResult = cge->Evaluate(this->Makefile, config, std::string targetResult = cge->Evaluate(this->Makefile, config,
@ -2792,7 +2764,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
// TARGET_PROPERTY expression. // TARGET_PROPERTY expression.
featureGenex = "$<$<BOOL:" + it->Value + ">:" + featureGenex + ">"; featureGenex = "$<$<BOOL:" + it->Value + ">:" + featureGenex + ">";
} }
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(&it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
featureGenex); featureGenex);
@ -5183,8 +5155,7 @@ cmTarget::ReportPropertyOrigin(const std::string &p,
areport += result; areport += result;
areport += "\"):\n" + report; areport += "\"):\n" + report;
cmListFileBacktrace lfbt; this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport, lfbt);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5921,10 +5892,9 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
} }
if(propertyLibs) if(propertyLibs)
{ {
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt);
cmGeneratorExpressionDAGChecker dagChecker(lfbt, cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), this->GetName(),
linkProp, 0, 0); linkProp, 0, 0);
cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
@ -6244,10 +6214,9 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
} }
// The interface libraries have been explicitly set. // The interface libraries have been explicitly set.
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt); cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), linkIfaceProp, 0, 0);
linkIfaceProp, 0, 0);
dagChecker.SetTransitivePropertiesOnly(); dagChecker.SetTransitivePropertiesOnly();
std::vector<std::string> libs; std::vector<std::string> libs;
cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate( cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
@ -6356,9 +6325,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
if(explicitLibraries) if(explicitLibraries)
{ {
// The interface libraries have been explicitly set. // The interface libraries have been explicitly set.
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt); cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
linkIfaceProp, 0, 0); linkIfaceProp, 0, 0);
cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate( cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate(
this->Makefile, this->Makefile,
@ -6383,9 +6351,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
{ {
// Compare the link implementation fallback link interface to the // Compare the link implementation fallback link interface to the
// preferred new link interface property and warn if different. // preferred new link interface property and warn if different.
cmListFileBacktrace lfbt; cmGeneratorExpression ge;
cmGeneratorExpression ge(lfbt); cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
"INTERFACE_LINK_LIBRARIES", 0, 0); "INTERFACE_LINK_LIBRARIES", 0, 0);
std::vector<std::string> ifaceLibs; std::vector<std::string> ifaceLibs;
const char* newExplicitLibraries = const char* newExplicitLibraries =

@ -55,8 +55,7 @@ bool cmTargetCompileOptionsCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool, bool) bool, bool)
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(this->Join(content), lfbt); cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertCompileOption(entry); tgt->InsertCompileOption(entry);
return true; return true;

@ -70,8 +70,7 @@ bool cmTargetIncludeDirectoriesCommand
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content, ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool prepend, bool system) bool prepend, bool system)
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(this->Join(content), lfbt); cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertInclude(entry, prepend); tgt->InsertInclude(entry, prepend);
if (system) if (system)

@ -17,24 +17,22 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTest::cmTest(cmMakefile* mf) cmTest::cmTest(cmMakefile* mf)
: Backtrace(mf->GetBacktrace())
{ {
this->Makefile = mf; this->Makefile = mf;
this->OldStyle = true; this->OldStyle = true;
this->Properties.SetCMakeInstance(mf->GetCMakeInstance()); this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
this->Backtrace = new cmListFileBacktrace;
this->Makefile->GetBacktrace(*this->Backtrace);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTest::~cmTest() cmTest::~cmTest()
{ {
delete this->Backtrace;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmListFileBacktrace const& cmTest::GetBacktrace() const cmListFileBacktrace const& cmTest::GetBacktrace() const
{ {
return *this->Backtrace; return this->Backtrace;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -14,8 +14,8 @@
#include "cmCustomCommand.h" #include "cmCustomCommand.h"
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
#include "cmListFileCache.h"
class cmMakefile; class cmMakefile;
class cmListFileBacktrace;
/** \class cmTest /** \class cmTest
* \brief Represent a test * \brief Represent a test
@ -71,7 +71,7 @@ private:
bool OldStyle; bool OldStyle;
cmMakefile* Makefile; cmMakefile* Makefile;
cmListFileBacktrace* Backtrace; cmListFileBacktrace Backtrace;
}; };
#endif #endif

@ -70,7 +70,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
this->TestGenerated = true; this->TestGenerated = true;
// Set up generator expression evaluation context. // Set up generator expression evaluation context.
cmGeneratorExpression ge(this->Test->GetBacktrace()); cmGeneratorExpression ge(&this->Test->GetBacktrace());
// Start the test command. // Start the test command.
os << indent << "add_test(" << this->Test->GetName() << " "; os << indent << "add_test(" << this->Test->GetName() << " ";

@ -2562,8 +2562,11 @@ static bool cmakeCheckStampList(const char* stampList)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmake::IssueMessage(cmake::MessageType t, std::string const& text, void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace) cmListFileBacktrace const& bt)
{ {
cmListFileBacktrace backtrace = bt;
backtrace.MakeRelative();
cmOStringStream msg; cmOStringStream msg;
bool isError = false; bool isError = false;
// Construct the message header. // Construct the message header.
@ -2786,7 +2789,7 @@ void cmake::RunCheckForUnusedVariables()
} }
if(haveUnused) if(haveUnused)
{ {
this->IssueMessage(cmake::WARNING, msg.str(), cmListFileBacktrace()); this->IssueMessage(cmake::WARNING, msg.str());
} }
#endif #endif
} }

@ -13,6 +13,7 @@
#ifndef cmake_h #ifndef cmake_h
#define cmake_h #define cmake_h
#include "cmListFileCache.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmPropertyDefinitionMap.h" #include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
@ -29,7 +30,6 @@ class cmFileTimeComparison;
class cmExternalMakefileProjectGenerator; class cmExternalMakefileProjectGenerator;
class cmDocumentationSection; class cmDocumentationSection;
class cmPolicies; class cmPolicies;
class cmListFileBacktrace;
class cmTarget; class cmTarget;
class cmGeneratedFileStream; class cmGeneratedFileStream;
@ -360,7 +360,7 @@ class cmake
/** Display a message to the user. */ /** Display a message to the user. */
void IssueMessage(cmake::MessageType t, std::string const& text, void IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace); cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL));
///! run the --build option ///! run the --build option
int Build(const std::string& dir, int Build(const std::string& dir,
const std::string& target, const std::string& target,

@ -1820,9 +1820,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options} --build-options ${build_options}
"--warn-unused-vars") "--warn-unused-vars")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):") PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):") FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32) if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32)