summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-27 12:16:59 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-02 21:14:02 (GMT)
commit6e636f2ebaf78141f4d0a36c96804b9a1bc89857 (patch)
tree6c46f8eea138028f770c2971f652bdcbbbb15d03 /Source
parent3676fb49634efd01755aa5c12d58e2f2bf20d09f (diff)
downloadCMake-6e636f2ebaf78141f4d0a36c96804b9a1bc89857.zip
CMake-6e636f2ebaf78141f4d0a36c96804b9a1bc89857.tar.gz
CMake-6e636f2ebaf78141f4d0a36c96804b9a1bc89857.tar.bz2
cmTarget: Make the SOURCES origin tracable.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx39
-rw-r--r--Source/cmTarget.h1
2 files changed, 37 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0b5734d..10ecbfa 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -224,6 +224,7 @@ cmTarget::cmTarget()
this->DebugIncludesDone = false;
this->DebugCompileOptionsDone = false;
this->DebugCompileDefinitionsDone = false;
+ this->DebugSourcesDone = false;
}
//----------------------------------------------------------------------------
@@ -553,7 +554,7 @@ static void processSources(cmTarget const* tgt,
std::set<std::string> &uniqueSrcs,
cmGeneratorExpressionDAGChecker *dagChecker,
cmTarget const* head,
- std::string const& config)
+ std::string const& config, bool debugSources)
{
cmMakefile *mf = tgt->GetMakefile();
@@ -601,6 +602,7 @@ static void processSources(cmTarget const* tgt,
(*it)->CachedEntries = entrySources;
}
}
+ std::string usedSources;
for(std::vector<std::string>::iterator
li = entrySources.begin(); li != entrySources.end(); ++li)
{
@@ -609,8 +611,19 @@ static void processSources(cmTarget const* tgt,
if(uniqueSrcs.insert(src).second)
{
srcs.push_back(src);
+ if (debugSources)
+ {
+ usedSources += " * " + src + "\n";
+ }
}
}
+ if (!usedSources.empty())
+ {
+ mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
+ std::string("Used sources for target ")
+ + tgt->GetName() + ":\n"
+ + usedSources, (*it)->ge->GetBacktrace());
+ }
}
}
@@ -621,6 +634,24 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
{
assert(this->GetType() != INTERFACE_LIBRARY);
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
+ {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugSources = !this->DebugSourcesDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "SOURCES")
+ != debugProperties.end();
+
+ if (this->Makefile->IsGeneratingBuildSystem())
+ {
+ this->DebugSourcesDone = true;
+ }
cmListFileBacktrace lfbt;
@@ -635,7 +666,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
uniqueSrcs,
&dagChecker,
head,
- config);
+ config,
+ debugSources);
if (!this->Internal->CacheLinkInterfaceSourcesDone[config])
{
@@ -686,7 +718,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
uniqueSrcs,
&dagChecker,
head,
- config);
+ config,
+ debugSources);
if (!this->Makefile->IsGeneratingBuildSystem())
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 15c49ea..055e029 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -710,6 +710,7 @@ private:
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileDefinitionsDone;
+ mutable bool DebugSourcesDone;
mutable std::set<std::string> LinkImplicitNullProperties;
bool BuildInterfaceIncludesAppended;