summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-12-18 15:16:14 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-03 18:45:40 (GMT)
commit0941d6232a979a129a651915972ab7332c15550d (patch)
tree9b7cb63ef89ca6aae92b03f28d82c06ffcbc1018 /Source/cmTarget.cxx
parent18a3195ad57cafd06851ecf4cb7265cab95cfa38 (diff)
downloadCMake-0941d6232a979a129a651915972ab7332c15550d.zip
CMake-0941d6232a979a129a651915972ab7332c15550d.tar.gz
CMake-0941d6232a979a129a651915972ab7332c15550d.tar.bz2
Add a way to print the origins of used include directories.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0c6bb1c..58fab80 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2485,6 +2485,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->IncludeDirectoriesEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
@@ -2507,6 +2508,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
this->Internal->IncludeDirectoriesEntries.push_back(
new cmTargetInternals::IncludeDirectoriesEntry(ge.Parse(value)));
@@ -2541,6 +2543,20 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
this->GetName(),
"INCLUDE_DIRECTORIES", 0, 0);
+
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugIncludes = std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "INCLUDE_DIRECTORIES")
+ != debugProperties.end();
+
for (std::vector<cmTargetInternals::IncludeDirectoriesEntry*>::const_iterator
it = this->Internal->IncludeDirectoriesEntries.begin(),
end = this->Internal->IncludeDirectoriesEntries.end();
@@ -2553,6 +2569,7 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
this,
&dagChecker),
entryIncludes);
+ std::string usedIncludes;
for(std::vector<std::string>::const_iterator
li = entryIncludes.begin(); li != entryIncludes.end(); ++li)
{
@@ -2565,8 +2582,18 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
if(uniqueIncludes.insert(inc).second)
{
includes.push_back(*li);
+ if (debugIncludes)
+ {
+ usedIncludes += " * " + *li + "\n";
+ }
}
}
+ if (!usedIncludes.empty())
+ {
+ this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG,
+ "Used includes:\n" + usedIncludes,
+ (*it)->ge->GetBacktrace());
+ }
}
return includes;
}