summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-16 15:49:10 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-23 13:22:07 (GMT)
commitd912220eaaa92f3e8524c33e1684ebbf84eba521 (patch)
tree51af981b604913add31a561a4dd3ac643ba0c832 /Source/cmComputeTargetDepends.cxx
parentedce43514d854a84d2a00c975268f898bd1dda45 (diff)
downloadCMake-d912220eaaa92f3e8524c33e1684ebbf84eba521.zip
CMake-d912220eaaa92f3e8524c33e1684ebbf84eba521.tar.gz
CMake-d912220eaaa92f3e8524c33e1684ebbf84eba521.tar.bz2
cmTarget: Lookup targets in LinkInterface and LinkImplementation
Instead of storing just the string names in these structures, lookup any target associated with each item and store its cmTarget pointer. Use the cmLinkItem class to hold the name and pointer together. Update client sites to use the pre-stored lookup result instead of looking up the target name again. Create a cmTarget::LookupLinkItems helper method to handle the lookup. Since lookups are now moving from cmComputeLinkDepends::AddLinkEntries to cmTarget::LookupLinkItems, move use of CheckCMP0004 to the latter. This drops use of CheckCMP0004 from entries added for _LIB_DEPENDS variables by cmComputeLinkDepends::AddVarLinkEntries, but I do not think that use was intentional originally anyway.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx30
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 6196542..3929af4 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -249,13 +249,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
const_cast<cmTarget*>(depender)->AddUtility(objLib);
}
}
- std::vector<std::string> tlibs;
- depender->GetDirectLinkLibraries(*it, tlibs);
+
+ cmTarget::LinkImplementation const* impl =
+ depender->GetLinkImplementation(*it);
// 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)
+ for(std::vector<cmLinkItem>::const_iterator
+ lib = impl->Libraries.begin();
+ lib != impl->Libraries.end(); ++lib)
{
// Don't emit the same library twice for this target.
if(emitted.insert(*lib).second)
@@ -269,11 +271,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
- std::set<std::string> const& tutils = depender->GetUtilities();
+ std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
std::set<std::string> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
- for(std::set<std::string>::const_iterator util = tutils.begin();
+ for(std::set<cmLinkItem>::const_iterator util = tutils.begin();
util != tutils.end(); ++util)
{
// Don't emit the same utility twice for this target.
@@ -295,7 +297,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(cmTarget::LinkInterface const* iface =
dependee->GetLinkInterface(config, depender))
{
- for(std::vector<std::string>::const_iterator
+ for(std::vector<cmLinkItem>::const_iterator
lib = iface->Libraries.begin();
lib != iface->Libraries.end(); ++lib)
{
@@ -311,12 +313,11 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- const std::string& dependee_name,
+ cmLinkItem const& dependee_name,
std::set<std::string> &emitted)
{
cmTarget const* depender = this->Targets[depender_index];
- cmTarget const* dependee =
- depender->GetMakefile()->FindTargetToUse(dependee_name);
+ cmTarget const* dependee = dependee_name.Target;
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
@@ -344,16 +345,15 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
}
//----------------------------------------------------------------------------
-void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- const std::string& dependee_name,
- bool linking)
+void cmComputeTargetDepends::AddTargetDepend(
+ int depender_index, cmLinkItem const& dependee_name,
+ bool linking)
{
// Get the depender.
cmTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first.
- cmTarget const* dependee =
- depender->GetMakefile()->FindTargetToUse(dependee_name);
+ cmTarget const* dependee = dependee_name.Target;
if(!dependee && !linking &&
(depender->GetType() != cmTarget::GLOBAL_TARGET))