cmTarget: Teach ExpandLinkItems how to support $<LINK_ONLY>

Add a 'usage_requirements_only' parameter to ExpandLinkItems so that it
knows whether to use SetTransitivePropertiesOnly while evaluating
generator expressions.  Update existing call sites to pass 'false' since
they are for linking and not usage requirements.
This commit is contained in:
Brad King 2014-06-16 14:23:22 -04:00
parent f5c18c9c1c
commit 1001490df2
2 changed files with 9 additions and 3 deletions

View File

@ -3688,10 +3688,15 @@ void cmTarget::ExpandLinkItems(std::string const& prop,
std::string const& value, std::string const& value,
std::string const& config, std::string const& config,
cmTarget const* headTarget, cmTarget const* headTarget,
bool usage_requirements_only,
std::vector<cmLinkItem>& items) const std::vector<cmLinkItem>& items) const
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
if(usage_requirements_only)
{
dagChecker.SetTransitivePropertiesOnly();
}
std::vector<std::string> libs; std::vector<std::string> libs;
cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate( cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate(
this->Makefile, this->Makefile,
@ -6135,7 +6140,7 @@ cmTarget::GetImportLinkInterface(const std::string& config,
iface.Multiplicity = info->Multiplicity; iface.Multiplicity = info->Multiplicity;
cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, iface.Libraries); headTarget, false, iface.Libraries);
{ {
std::vector<std::string> deps; std::vector<std::string> deps;
cmSystemTools::ExpandListArgument(info->SharedDeps, deps); cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
@ -6341,7 +6346,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
{ {
// The interface libraries have been explicitly set. // The interface libraries have been explicitly set.
this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
headTarget, iface.Libraries); headTarget, false, iface.Libraries);
} }
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|| this->PolicyStatusCMP0022 == cmPolicies::OLD) || this->PolicyStatusCMP0022 == cmPolicies::OLD)
@ -6364,7 +6369,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
if(const char* newExplicitLibraries = this->GetProperty(newProp)) if(const char* newExplicitLibraries = this->GetProperty(newProp))
{ {
this->ExpandLinkItems(newProp, newExplicitLibraries, config, this->ExpandLinkItems(newProp, newExplicitLibraries, config,
headTarget, ifaceLibs); headTarget, false, ifaceLibs);
} }
if (ifaceLibs != impl->Libraries) if (ifaceLibs != impl->Libraries)
{ {

View File

@ -777,6 +777,7 @@ private:
void ExpandLinkItems(std::string const& prop, std::string const& value, void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget, std::string const& config, cmTarget const* headTarget,
bool usage_requirements_only,
std::vector<cmLinkItem>& items) const; std::vector<cmLinkItem>& items) const;
void LookupLinkItems(std::vector<std::string> const& names, void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const; std::vector<cmLinkItem>& items) const;