summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-03 16:51:53 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-04-03 16:51:53 (GMT)
commit5376151aa1d724b6d7ddef8d2e521d97cbfa74ae (patch)
tree88ceb52c0ff365ceb53ea408f45fe729cfbd7f3c /Source/cmGeneratorTarget.cxx
parent93054aa84f283de17c58fa2ee19a2a4a1668027d (diff)
parent9407174b1a0f1b4f8edf7fe08cc85ab6e990d59f (diff)
downloadCMake-5376151aa1d724b6d7ddef8d2e521d97cbfa74ae.zip
CMake-5376151aa1d724b6d7ddef8d2e521d97cbfa74ae.tar.gz
CMake-5376151aa1d724b6d7ddef8d2e521d97cbfa74ae.tar.bz2
Merge topic 'target-transitive-sources'
9407174b target_sources: New command to add sources to target. 81ad69e0 Make the SOURCES target property writable. 6e636f2e cmTarget: Make the SOURCES origin tracable. 3676fb49 cmTarget: Allow transitive evaluation of SOURCES property. e6971df6 cmTarget: Make the source files depend on the config. df753df9 cmGeneratorTarget: Don't add computed sources to the target. 869328aa cmComputeTargetDepends: Use valid config to compute target depends.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx75
1 files changed, 56 insertions, 19 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 321dd42..01fad26 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -289,7 +289,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \
{ \
std::vector<cmSourceFile*> sourceFiles; \
- this->Target->GetSourceFiles(sourceFiles); \
+ this->Target->GetSourceFiles(sourceFiles, config); \
TagVisitor<DATA ## Tag DATATYPE> visitor(this->Target, data); \
for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \
si != sourceFiles.end(); ++si) \
@@ -308,7 +308,8 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
//----------------------------------------------------------------------------
void
cmGeneratorTarget
-::GetObjectSources(std::vector<cmSourceFile const*> &data) const
+::GetObjectSources(std::vector<cmSourceFile const*> &data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(ObjectSources);
@@ -332,8 +333,19 @@ void cmGeneratorTarget::ComputeObjectMapping()
{
return;
}
- std::vector<cmSourceFile const*> sourceFiles;
- this->GetObjectSources(sourceFiles);
+
+ std::vector<std::string> configs;
+ this->Makefile->GetConfigurations(configs);
+ if (configs.empty())
+ {
+ configs.push_back("");
+ }
+ for(std::vector<std::string>::const_iterator ci = configs.begin();
+ ci != configs.end(); ++ci)
+ {
+ std::vector<cmSourceFile const*> sourceFiles;
+ this->GetObjectSources(sourceFiles, *ci);
+ }
}
//----------------------------------------------------------------------------
@@ -360,7 +372,8 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
//----------------------------------------------------------------------------
void cmGeneratorTarget
-::GetIDLSources(std::vector<cmSourceFile const*>& data) const
+::GetIDLSources(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(IDLSources);
}
@@ -368,14 +381,16 @@ void cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
-::GetHeaderSources(std::vector<cmSourceFile const*>& data) const
+::GetHeaderSources(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(HeaderSources);
}
//----------------------------------------------------------------------------
void cmGeneratorTarget
-::GetExtraSources(std::vector<cmSourceFile const*>& data) const
+::GetExtraSources(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(ExtraSources);
}
@@ -383,7 +398,8 @@ void cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
-::GetCustomCommands(std::vector<cmSourceFile const*>& data) const
+::GetCustomCommands(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(CustomCommands);
}
@@ -391,14 +407,16 @@ cmGeneratorTarget
//----------------------------------------------------------------------------
void
cmGeneratorTarget
-::GetExternalObjects(std::vector<cmSourceFile const*>& data) const
+::GetExternalObjects(std::vector<cmSourceFile const*>& data,
+ const std::string& config) const
{
IMPLEMENT_VISIT(ExternalObjects);
}
//----------------------------------------------------------------------------
void
-cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
+cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs,
+ const std::string& config) const
{
ResxData data;
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
@@ -407,7 +425,8 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
//----------------------------------------------------------------------------
void cmGeneratorTarget
-::GetResxSources(std::vector<cmSourceFile const*>& srcs) const
+::GetResxSources(std::vector<cmSourceFile const*>& srcs,
+ const std::string& config) const
{
ResxData data;
IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData)
@@ -517,13 +536,15 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files) const
+void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
+ const std::string& config) const
{
- this->Target->GetSourceFiles(files);
+ this->Target->GetSourceFiles(files, config);
}
//----------------------------------------------------------------------------
-std::string cmGeneratorTarget::GetModuleDefinitionFile() const
+std::string
+cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
{
std::string data;
IMPLEMENT_VISIT_IMPL(ModuleDefinitionFile, COMMA std::string)
@@ -532,10 +553,11 @@ std::string cmGeneratorTarget::GetModuleDefinitionFile() const
//----------------------------------------------------------------------------
void
-cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
+cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs,
+ const std::string &config) const
{
std::vector<cmSourceFile const*> objectFiles;
- this->GetExternalObjects(objectFiles);
+ this->GetExternalObjects(objectFiles, config);
std::vector<cmTarget*> objectLibraries;
std::set<cmTarget*> emitted;
for(std::vector<cmSourceFile const*>::const_iterator
@@ -559,7 +581,7 @@ cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) const
cmGeneratorTarget* ogt =
this->GlobalGenerator->GetGeneratorTarget(objLib);
std::vector<cmSourceFile const*> objectSources;
- ogt->GetObjectSources(objectSources);
+ ogt->GetObjectSources(objectSources, config);
for(std::vector<cmSourceFile const*>::const_iterator
si = objectSources.begin();
si != objectSources.end(); ++si)
@@ -615,11 +637,26 @@ cmTargetTraceDependencies
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
std::vector<std::string> sources;
- this->Target->GetSourceFiles(sources);
+ std::vector<std::string> configs;
+ this->Makefile->GetConfigurations(configs);
+ if (configs.empty())
+ {
+ configs.push_back("");
+ }
+ for(std::vector<std::string>::const_iterator ci = configs.begin();
+ ci != configs.end(); ++ci)
+ {
+ this->Target->GetSourceFiles(sources, *ci);
+ }
+ std::set<std::string> emitted;
for(std::vector<std::string>::const_iterator si = sources.begin();
si != sources.end(); ++si)
{
- this->QueueSource(*si);
+ if(emitted.insert(*si).second && this->SourcesQueued.insert(*si).second)
+ {
+ this->SourceQueue.push(*si);
+ this->Makefile->GetOrCreateSource(*si);
+ }
}
}