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.
This commit is contained in:
Brad King
2014-06-16 11:49:10 -04:00
parent edce43514d
commit d912220eaa
8 changed files with 123 additions and 101 deletions
+8 -6
View File
@@ -259,10 +259,10 @@ public:
std::vector<std::string> Languages;
// Libraries listed in the interface.
std::vector<std::string> Libraries;
std::vector<cmLinkItem> Libraries;
// Shared library dependencies needed for linking on some platforms.
std::vector<std::string> SharedDeps;
std::vector<cmLinkItem> SharedDeps;
// Number of repetitions of a strongly connected component of two
// or more static libraries.
@@ -270,7 +270,7 @@ public:
// Libraries listed for other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<std::string> WrongConfigLibraries;
std::vector<cmLinkItem> WrongConfigLibraries;
bool ImplementationIsInterface;
@@ -297,11 +297,11 @@ public:
std::vector<std::string> Languages;
// Libraries linked directly in this configuration.
std::vector<std::string> Libraries;
std::vector<cmLinkItem> Libraries;
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<std::string> WrongConfigLibraries;
std::vector<cmLinkItem> WrongConfigLibraries;
};
LinkImplementation const*
GetLinkImplementation(const std::string& config) const;
@@ -782,7 +782,9 @@ private:
void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget,
std::vector<std::string>& libs) const;
std::vector<cmLinkItem>& items) const;
void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const;
std::string ProcessSourceItemCMP0049(const std::string& s);