summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-13 16:25:00 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-02 21:14:02 (GMT)
commite6971df6ab647031ba9689c9afbbde78cc62e35f (patch)
treec9c67c6e3a1627d65cda8ee93373b97403c92106 /Source/cmComputeTargetDepends.cxx
parentdf753df94bb1e995372baabb0240585560c72ded (diff)
downloadCMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.zip
CMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.tar.gz
CMake-e6971df6ab647031ba9689c9afbbde78cc62e35f.tar.bz2
cmTarget: Make the source files depend on the config.
Disallow the use of config-specific source files with the Visual Studio and Xcode generators. They don't have any way to represent the condition currently. Use the same common-config API in cmQtAutoGenerators. While it accepts config-specific files, it doesn't have to support multiple configurations yet. Loop over the configs in cmTargetTraceDependencies and cmGlobalGenerator::WriteSummary and consume all source files. Loop over the configs in cmComputeTargetDepends and compute the object library dependencies for each config.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx49
1 files changed, 24 insertions, 25 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index f07bccb..8655cb7 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -213,34 +213,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// deal with config-specific dependencies.
{
std::set<std::string> emitted;
- {
cmGeneratorTarget* gt = depender->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()
->GetGeneratorTarget(depender);
- std::vector<cmSourceFile const*> objectFiles;
- gt->GetExternalObjects(objectFiles);
- for(std::vector<cmSourceFile const*>::const_iterator
- it = objectFiles.begin(); it != objectFiles.end(); ++it)
- {
- std::string objLib = (*it)->GetObjectLibrary();
- if (!objLib.empty() && emitted.insert(objLib).second)
- {
- if(depender->GetType() != cmTarget::EXECUTABLE &&
- depender->GetType() != cmTarget::STATIC_LIBRARY &&
- depender->GetType() != cmTarget::SHARED_LIBRARY &&
- depender->GetType() != cmTarget::MODULE_LIBRARY)
- {
- this->GlobalGenerator->GetCMakeInstance()
- ->IssueMessage(cmake::FATAL_ERROR,
- "Only executables and non-OBJECT libraries may "
- "reference target objects.",
- depender->GetBacktrace());
- return;
- }
- const_cast<cmTarget*>(depender)->AddUtility(objLib);
- }
- }
- }
+
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
if (configs.empty())
@@ -250,6 +226,29 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
+ std::vector<cmSourceFile const*> objectFiles;
+ gt->GetExternalObjects(objectFiles, *it);
+ for(std::vector<cmSourceFile const*>::const_iterator
+ oi = objectFiles.begin(); oi != objectFiles.end(); ++oi)
+ {
+ std::string objLib = (*oi)->GetObjectLibrary();
+ if (!objLib.empty() && emitted.insert(objLib).second)
+ {
+ if(depender->GetType() != cmTarget::EXECUTABLE &&
+ depender->GetType() != cmTarget::STATIC_LIBRARY &&
+ depender->GetType() != cmTarget::SHARED_LIBRARY &&
+ depender->GetType() != cmTarget::MODULE_LIBRARY)
+ {
+ this->GlobalGenerator->GetCMakeInstance()
+ ->IssueMessage(cmake::FATAL_ERROR,
+ "Only executables and non-OBJECT libraries may "
+ "reference target objects.",
+ depender->GetBacktrace());
+ return;
+ }
+ const_cast<cmTarget*>(depender)->AddUtility(objLib);
+ }
+ }
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries(*it, tlibs, depender);