diff options
author | Brad King <brad.king@kitware.com> | 2014-04-03 16:51:53 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-04-03 16:51:53 (GMT) |
commit | 5376151aa1d724b6d7ddef8d2e521d97cbfa74ae (patch) | |
tree | 88ceb52c0ff365ceb53ea408f45fe729cfbd7f3c /Source/cmComputeTargetDepends.cxx | |
parent | 93054aa84f283de17c58fa2ee19a2a4a1668027d (diff) | |
parent | 9407174b1a0f1b4f8edf7fe08cc85ab6e990d59f (diff) | |
download | CMake-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/cmComputeTargetDepends.cxx')
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 27fc862..eb62455 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -213,56 +213,42 @@ 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> tlibs; - depender->GetDirectLinkLibraries("", tlibs, depender); - // A target should not depend on itself. - emitted.insert(depender->GetName()); - for(std::vector<std::string>::const_iterator lib = tlibs.begin(); - lib != tlibs.end(); ++lib) - { - // Don't emit the same library twice for this target. - if(emitted.insert(*lib).second) - { - this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, - true, emitted); - } - } - } + std::vector<std::string> configs; depender->GetMakefile()->GetConfigurations(configs); + if (configs.empty()) + { + configs.push_back(""); + } 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); |