cmTarget: Refactor LinkImplementation to allow more information

Create a cmLinkImplItem class derived from cmLinkItem so more
information can be added to link implementation entries than link
interface entries.  Convert the LinkImplementation Libraries member to
hold it.  Update client sites accordingly.
This commit is contained in:
Brad King 2014-06-30 10:38:59 -04:00
parent f85ccf23ee
commit 848c8ccf18
5 changed files with 27 additions and 14 deletions

View File

@ -255,7 +255,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<cmLinkItem>::const_iterator
for(std::vector<cmLinkImplItem>::const_iterator
lib = impl->Libraries.begin();
lib != impl->Libraries.end(); ++lib)
{

View File

@ -844,7 +844,7 @@ getLinkedTargetsContent(
std::string
getLinkedTargetsContent(
std::vector<cmLinkItem> const &libraries,
std::vector<cmLinkImplItem> const &libraries,
cmTarget const* target,
cmTarget const* headTarget,
cmGeneratorExpressionContext *context,
@ -852,7 +852,7 @@ getLinkedTargetsContent(
const std::string &interfacePropertyName)
{
std::vector<cmTarget const*> tgts;
for (std::vector<cmLinkItem>::const_iterator
for (std::vector<cmLinkImplItem>::const_iterator
it = libraries.begin();
it != libraries.end(); ++it)
{

View File

@ -475,8 +475,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
}
std::set<cmTarget const*> uniqueDeps;
for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin();
li != impl->Libraries.end(); ++li)
for(std::vector<cmLinkImplItem>::const_iterator
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
{
cmTarget const* tgt = li->Target;
if (!tgt)

View File

@ -2281,7 +2281,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
if(this->Makefile->IsOn("APPLE"))
{
LinkImplementation const* impl = this->GetLinkImplementation(config);
for(std::vector<cmLinkItem>::const_iterator
for(std::vector<cmLinkImplItem>::const_iterator
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
{
@ -3675,7 +3675,8 @@ void cmTarget::ComputeLinkClosure(const std::string& config,
// Add interface languages from linked targets.
cmTargetCollectLinkLanguages cll(this, config, languages, this);
for(std::vector<cmLinkItem>::const_iterator li = impl->Libraries.begin();
for(std::vector<cmLinkImplItem>::const_iterator
li = impl->Libraries.begin();
li != impl->Libraries.end(); ++li)
{
cll.Visit(*li);
@ -6242,7 +6243,8 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
cmTarget::LinkImplementation const* impl
= this->GetLinkImplementationLibraries(config);
for(std::vector<cmLinkItem>::const_iterator it = impl->Libraries.begin();
for(std::vector<cmLinkImplItem>::const_iterator
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
{
processILibs(config, this, *it, tgts , emitted);
@ -6383,7 +6385,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
// The link implementation is the default link interface.
LinkImplementation const* impl =
this->GetLinkImplementationLibrariesInternal(config, headTarget);
iface.Libraries = impl->Libraries;
std::copy(impl->Libraries.begin(), impl->Libraries.end(),
std::back_inserter(iface.Libraries));
if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
!this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only)
{
@ -6397,12 +6400,12 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
headTarget, usage_requirements_only,
ifaceLibs);
}
if (ifaceLibs != impl->Libraries)
if (ifaceLibs != iface.Libraries)
{
std::string oldLibraries;
std::string newLibraries;
const char *sep = "";
for(std::vector<cmLinkItem>::const_iterator it
for(std::vector<cmLinkImplItem>::const_iterator it
= impl->Libraries.begin(); it != impl->Libraries.end(); ++it)
{
oldLibraries += sep;
@ -6470,7 +6473,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
{
cmTarget::LinkImplementation const* impl =
thisTarget->GetLinkImplementation(config);
for(std::vector<cmLinkItem>::const_iterator
for(std::vector<cmLinkImplItem>::const_iterator
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
{
if(emitted.insert(*li).second)
@ -6674,7 +6677,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
// The entry is meant for this configuration.
impl.Libraries.push_back(
cmLinkItem(name, this->FindTargetToLink(name)));
cmLinkImplItem(name, this->FindTargetToLink(name)));
}
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();

View File

@ -54,6 +54,16 @@ public:
cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {}
cmTarget const* Target;
};
class cmLinkImplItem: public cmLinkItem
{
public:
cmLinkImplItem(): cmLinkItem() {}
cmLinkImplItem(std::string const& n,
cmTarget const* t):
cmLinkItem(n, t) {}
cmLinkImplItem(cmLinkImplItem const& r):
cmLinkItem(r) {}
};
struct cmTargetLinkInformationMap:
public std::map<std::string, cmComputeLinkInformation*>
@ -296,7 +306,7 @@ public:
std::vector<std::string> Languages;
// Libraries linked directly in this configuration.
std::vector<cmLinkItem> Libraries;
std::vector<cmLinkImplItem> Libraries;
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.