cmTarget: Remove 'head' argument from GetLinkImplementation
Many of the 'head' arguments added by commit v2.8.11~289^2~1 (Make linking APIs aware of 'head' target, 2013-01-04) turned out not to be needed. The "link implementation" of a target never needs to be computed with anything but itself as the 'head' target (except for CMP0022 OLD behavior because then it is the link interface). Remove the unused 'head' target paths. Add "internal" versions of cmTarget::GetDirectLinkLibraries and GetLinkImplementationLibraries to support the CMP0022 OLD behavior without otherwise exposing the 'head' target option of these methods.
This commit is contained in:
parent
4ac72455fd
commit
0dc9e88d76
|
@ -542,7 +542,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
|
||||||
{
|
{
|
||||||
// Add direct link dependencies in this configuration.
|
// Add direct link dependencies in this configuration.
|
||||||
cmTarget::LinkImplementation const* impl =
|
cmTarget::LinkImplementation const* impl =
|
||||||
this->Target->GetLinkImplementation(this->Config, this->Target);
|
this->Target->GetLinkImplementation(this->Config);
|
||||||
this->AddLinkEntries(-1, impl->Libraries);
|
this->AddLinkEntries(-1, impl->Libraries);
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
wi = impl->WrongConfigLibraries.begin();
|
wi = impl->WrongConfigLibraries.begin();
|
||||||
|
|
|
@ -250,7 +250,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<std::string> tlibs;
|
std::vector<std::string> tlibs;
|
||||||
depender->GetDirectLinkLibraries(*it, tlibs, depender);
|
depender->GetDirectLinkLibraries(*it, tlibs);
|
||||||
|
|
||||||
// A target should not depend on itself.
|
// A target should not depend on itself.
|
||||||
emitted.insert(depender->GetName());
|
emitted.insert(depender->GetName());
|
||||||
|
|
|
@ -1098,8 +1098,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
cmStrCmp(interfacePropertyName)) != transEnd)
|
cmStrCmp(interfacePropertyName)) != transEnd)
|
||||||
{
|
{
|
||||||
const cmTarget::LinkImplementation *impl
|
const cmTarget::LinkImplementation *impl
|
||||||
= target->GetLinkImplementationLibraries(context->Config,
|
= target->GetLinkImplementationLibraries(context->Config);
|
||||||
headTarget);
|
|
||||||
if(impl)
|
if(impl)
|
||||||
{
|
{
|
||||||
linkedTargetsContent =
|
linkedTargetsContent =
|
||||||
|
|
|
@ -449,7 +449,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
|
||||||
if (iter == this->SystemIncludesCache.end())
|
if (iter == this->SystemIncludesCache.end())
|
||||||
{
|
{
|
||||||
cmTarget::LinkImplementation const* impl
|
cmTarget::LinkImplementation const* impl
|
||||||
= this->Target->GetLinkImplementation(config, this->Target);
|
= this->Target->GetLinkImplementation(config);
|
||||||
if(!impl)
|
if(!impl)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1255,7 +1255,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
|
||||||
|
|
||||||
// If the language is compiled as a source trust Xcode to link with it.
|
// If the language is compiled as a source trust Xcode to link with it.
|
||||||
cmTarget::LinkImplementation const* impl =
|
cmTarget::LinkImplementation const* impl =
|
||||||
cmtarget.GetLinkImplementation("NOCONFIG", &cmtarget);
|
cmtarget.GetLinkImplementation("NOCONFIG");
|
||||||
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
||||||
li != impl->Languages.end(); ++li)
|
li != impl->Languages.end(); ++li)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1198,8 +1198,15 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::GetDirectLinkLibraries(const std::string& config,
|
void cmTarget::GetDirectLinkLibraries(const std::string& config,
|
||||||
std::vector<std::string> &libs,
|
std::vector<std::string> &libs) const
|
||||||
cmTarget const* head) const
|
{
|
||||||
|
this->GetDirectLinkLibrariesInternal(config, libs, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmTarget::GetDirectLinkLibrariesInternal(const std::string& config,
|
||||||
|
std::vector<std::string> &libs,
|
||||||
|
cmTarget const* head) const
|
||||||
{
|
{
|
||||||
const char *prop = this->GetProperty("LINK_LIBRARIES");
|
const char *prop = this->GetProperty("LINK_LIBRARIES");
|
||||||
if (prop)
|
if (prop)
|
||||||
|
@ -2273,8 +2280,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const
|
||||||
|
|
||||||
if(this->Makefile->IsOn("APPLE"))
|
if(this->Makefile->IsOn("APPLE"))
|
||||||
{
|
{
|
||||||
LinkImplementation const* impl = this->GetLinkImplementation(config,
|
LinkImplementation const* impl = this->GetLinkImplementation(config);
|
||||||
this);
|
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
it = impl->Libraries.begin();
|
it = impl->Libraries.begin();
|
||||||
it != impl->Libraries.end(); ++it)
|
it != impl->Libraries.end(); ++it)
|
||||||
|
@ -3632,7 +3638,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config,
|
||||||
{
|
{
|
||||||
// Get languages built in this target.
|
// Get languages built in this target.
|
||||||
std::set<std::string> languages;
|
std::set<std::string> languages;
|
||||||
LinkImplementation const* impl = this->GetLinkImplementation(config, this);
|
LinkImplementation const* impl = this->GetLinkImplementation(config);
|
||||||
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
||||||
li != impl->Languages.end(); ++li)
|
li != impl->Languages.end(); ++li)
|
||||||
{
|
{
|
||||||
|
@ -4500,7 +4506,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<std::string> libs;
|
std::vector<std::string> libs;
|
||||||
this->GetDirectLinkLibraries(config, libs, this);
|
this->GetDirectLinkLibraries(config, libs);
|
||||||
return !libs.empty();
|
return !libs.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6151,7 +6157,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
|
||||||
std::set<cmTarget*> emitted;
|
std::set<cmTarget*> emitted;
|
||||||
|
|
||||||
cmTarget::LinkImplementation const* impl
|
cmTarget::LinkImplementation const* impl
|
||||||
= this->GetLinkImplementationLibraries(config, this);
|
= this->GetLinkImplementationLibraries(config);
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it = impl->Libraries.begin();
|
for(std::vector<std::string>::const_iterator it = impl->Libraries.begin();
|
||||||
it != impl->Libraries.end(); ++it)
|
it != impl->Libraries.end(); ++it)
|
||||||
|
@ -6321,7 +6327,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
{
|
{
|
||||||
// The link implementation is the default link interface.
|
// The link implementation is the default link interface.
|
||||||
LinkImplementation const* impl =
|
LinkImplementation const* impl =
|
||||||
this->GetLinkImplementationLibraries(config, headTarget);
|
this->GetLinkImplementationLibrariesInternal(config, headTarget);
|
||||||
iface.Libraries = impl->Libraries;
|
iface.Libraries = impl->Libraries;
|
||||||
if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
||||||
!this->Internal->PolicyWarnedCMP0022)
|
!this->Internal->PolicyWarnedCMP0022)
|
||||||
|
@ -6407,7 +6413,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY)
|
if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY)
|
||||||
{
|
{
|
||||||
cmTarget::LinkImplementation const* impl =
|
cmTarget::LinkImplementation const* impl =
|
||||||
thisTarget->GetLinkImplementation(config, headTarget);
|
thisTarget->GetLinkImplementation(config);
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
|
li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
|
||||||
{
|
{
|
||||||
|
@ -6438,7 +6444,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
{
|
{
|
||||||
// The link implementation is the default link interface.
|
// The link implementation is the default link interface.
|
||||||
cmTarget::LinkImplementation const*
|
cmTarget::LinkImplementation const*
|
||||||
impl = thisTarget->GetLinkImplementation(config, headTarget);
|
impl = thisTarget->GetLinkImplementationLibrariesInternal(config,
|
||||||
|
headTarget);
|
||||||
iface.ImplementationIsInterface = true;
|
iface.ImplementationIsInterface = true;
|
||||||
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
||||||
}
|
}
|
||||||
|
@ -6447,7 +6454,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
{
|
{
|
||||||
// Targets using this archive need its language runtime libraries.
|
// Targets using this archive need its language runtime libraries.
|
||||||
if(cmTarget::LinkImplementation const* impl =
|
if(cmTarget::LinkImplementation const* impl =
|
||||||
thisTarget->GetLinkImplementation(config, headTarget))
|
thisTarget->GetLinkImplementation(config))
|
||||||
{
|
{
|
||||||
iface.Languages = impl->Languages;
|
iface.Languages = impl->Languages;
|
||||||
}
|
}
|
||||||
|
@ -6485,8 +6492,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkImplementation const*
|
cmTarget::LinkImplementation const*
|
||||||
cmTarget::GetLinkImplementation(const std::string& config,
|
cmTarget::GetLinkImplementation(const std::string& config) const
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
{
|
||||||
// There is no link implementation for imported targets.
|
// There is no link implementation for imported targets.
|
||||||
if(this->IsImported())
|
if(this->IsImported())
|
||||||
|
@ -6495,7 +6501,7 @@ cmTarget::GetLinkImplementation(const std::string& config,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup any existing link implementation for this configuration.
|
// Lookup any existing link implementation for this configuration.
|
||||||
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(this, cmSystemTools::UpperCase(config));
|
||||||
|
|
||||||
cmTargetInternals::LinkImplMapType::iterator
|
cmTargetInternals::LinkImplMapType::iterator
|
||||||
i = this->Internal->LinkImplMap.find(key);
|
i = this->Internal->LinkImplMap.find(key);
|
||||||
|
@ -6503,8 +6509,8 @@ cmTarget::GetLinkImplementation(const std::string& config,
|
||||||
{
|
{
|
||||||
// Compute the link implementation for this configuration.
|
// Compute the link implementation for this configuration.
|
||||||
LinkImplementation impl;
|
LinkImplementation impl;
|
||||||
this->ComputeLinkImplementation(config, impl, head);
|
this->ComputeLinkImplementation(config, impl, this);
|
||||||
this->ComputeLinkImplementationLanguages(config, impl, head);
|
this->ComputeLinkImplementationLanguages(config, impl, this);
|
||||||
|
|
||||||
// Store the information for this configuration.
|
// Store the information for this configuration.
|
||||||
cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
|
cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
|
||||||
|
@ -6512,7 +6518,7 @@ cmTarget::GetLinkImplementation(const std::string& config,
|
||||||
}
|
}
|
||||||
else if (i->second.Languages.empty())
|
else if (i->second.Languages.empty())
|
||||||
{
|
{
|
||||||
this->ComputeLinkImplementationLanguages(config, i->second, head);
|
this->ComputeLinkImplementationLanguages(config, i->second, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &i->second;
|
return &i->second;
|
||||||
|
@ -6520,8 +6526,15 @@ cmTarget::GetLinkImplementation(const std::string& config,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkImplementation const*
|
cmTarget::LinkImplementation const*
|
||||||
cmTarget::GetLinkImplementationLibraries(const std::string& config,
|
cmTarget::GetLinkImplementationLibraries(const std::string& config) const
|
||||||
cmTarget const* head) const
|
{
|
||||||
|
return this->GetLinkImplementationLibrariesInternal(config, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
cmTarget::LinkImplementation const*
|
||||||
|
cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
|
||||||
|
cmTarget const* head) const
|
||||||
{
|
{
|
||||||
// There is no link implementation for imported targets.
|
// There is no link implementation for imported targets.
|
||||||
if(this->IsImported())
|
if(this->IsImported())
|
||||||
|
@ -6555,7 +6568,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
|
||||||
{
|
{
|
||||||
// Collect libraries directly linked in this configuration.
|
// Collect libraries directly linked in this configuration.
|
||||||
std::vector<std::string> llibs;
|
std::vector<std::string> llibs;
|
||||||
this->GetDirectLinkLibraries(config, llibs, head);
|
this->GetDirectLinkLibrariesInternal(config, llibs, head);
|
||||||
for(std::vector<std::string>::const_iterator li = llibs.begin();
|
for(std::vector<std::string>::const_iterator li = llibs.begin();
|
||||||
li != llibs.end(); ++li)
|
li != llibs.end(); ++li)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,8 +158,7 @@ public:
|
||||||
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
|
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
|
||||||
{return this->OriginalLinkLibraries;}
|
{return this->OriginalLinkLibraries;}
|
||||||
void GetDirectLinkLibraries(const std::string& config,
|
void GetDirectLinkLibraries(const std::string& config,
|
||||||
std::vector<std::string> &,
|
std::vector<std::string> &) const;
|
||||||
cmTarget const* head) const;
|
|
||||||
|
|
||||||
/** Compute the link type to use for the given configuration. */
|
/** Compute the link type to use for the given configuration. */
|
||||||
LinkLibraryType ComputeLinkType(const std::string& config) const;
|
LinkLibraryType ComputeLinkType(const std::string& config) const;
|
||||||
|
@ -291,12 +290,11 @@ public:
|
||||||
// Needed only for OLD behavior of CMP0003.
|
// Needed only for OLD behavior of CMP0003.
|
||||||
std::vector<std::string> WrongConfigLibraries;
|
std::vector<std::string> WrongConfigLibraries;
|
||||||
};
|
};
|
||||||
LinkImplementation const* GetLinkImplementation(const std::string& config,
|
LinkImplementation const*
|
||||||
cmTarget const* head) const;
|
GetLinkImplementation(const std::string& config) const;
|
||||||
|
|
||||||
LinkImplementation const* GetLinkImplementationLibraries(
|
LinkImplementation const*
|
||||||
const std::string& config,
|
GetLinkImplementationLibraries(const std::string& config) const;
|
||||||
cmTarget const* head) const;
|
|
||||||
|
|
||||||
/** Link information from the transitive closure of the link
|
/** Link information from the transitive closure of the link
|
||||||
implementation and the interfaces of its dependencies. */
|
implementation and the interfaces of its dependencies. */
|
||||||
|
@ -750,6 +748,12 @@ private:
|
||||||
cmTarget const* head,
|
cmTarget const* head,
|
||||||
bool &exists) const;
|
bool &exists) const;
|
||||||
|
|
||||||
|
void GetDirectLinkLibrariesInternal(const std::string& config,
|
||||||
|
std::vector<std::string>& libs,
|
||||||
|
cmTarget const* head) const;
|
||||||
|
LinkImplementation const*
|
||||||
|
GetLinkImplementationLibrariesInternal(const std::string& config,
|
||||||
|
cmTarget const* head) const;
|
||||||
void ComputeLinkImplementation(const std::string& config,
|
void ComputeLinkImplementation(const std::string& config,
|
||||||
LinkImplementation& impl,
|
LinkImplementation& impl,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
|
|
Loading…
Reference in New Issue