cmTarget: De-duplicate library list expansion
Create an ExpandLinkItems method to handle evaluation of generator expressions in a library list and expansion of the ;-list into a vector. Replace some duplicate copies of the implementation with calls to the new helper.
This commit is contained in:
parent
6354df92b1
commit
8d15a1bbfb
@ -3691,6 +3691,23 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmTarget::ExpandLinkItems(std::string const& prop,
|
||||||
|
std::string const& value,
|
||||||
|
std::string const& config,
|
||||||
|
cmTarget const* headTarget,
|
||||||
|
std::vector<std::string>& libs) const
|
||||||
|
{
|
||||||
|
cmGeneratorExpression ge;
|
||||||
|
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
|
||||||
|
cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate(
|
||||||
|
this->Makefile,
|
||||||
|
config,
|
||||||
|
false,
|
||||||
|
headTarget,
|
||||||
|
this, &dagChecker), libs);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmTarget::GetSuffixVariableInternal(bool implib) const
|
const char* cmTarget::GetSuffixVariableInternal(bool implib) const
|
||||||
{
|
{
|
||||||
@ -5870,19 +5887,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
|||||||
}
|
}
|
||||||
if(propertyLibs)
|
if(propertyLibs)
|
||||||
{
|
{
|
||||||
cmGeneratorExpression ge;
|
this->ExpandLinkItems(linkProp, propertyLibs, desired_config,
|
||||||
|
headTarget, info.LinkInterface.Libraries);
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(
|
|
||||||
this->GetName(),
|
|
||||||
linkProp, 0, 0);
|
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
|
|
||||||
->Evaluate(this->Makefile,
|
|
||||||
desired_config,
|
|
||||||
false,
|
|
||||||
headTarget,
|
|
||||||
this,
|
|
||||||
&dagChecker),
|
|
||||||
info.LinkInterface.Libraries);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this->GetType() == INTERFACE_LIBRARY)
|
if(this->GetType() == INTERFACE_LIBRARY)
|
||||||
@ -6302,15 +6308,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
|||||||
if(explicitLibraries)
|
if(explicitLibraries)
|
||||||
{
|
{
|
||||||
// The interface libraries have been explicitly set.
|
// The interface libraries have been explicitly set.
|
||||||
cmGeneratorExpression ge;
|
this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
headTarget, iface.Libraries);
|
||||||
linkIfaceProp, 0, 0);
|
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(explicitLibraries)->Evaluate(
|
|
||||||
this->Makefile,
|
|
||||||
config,
|
|
||||||
false,
|
|
||||||
headTarget,
|
|
||||||
this, &dagChecker), iface.Libraries);
|
|
||||||
}
|
}
|
||||||
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|
||||||
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
|
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
|
||||||
@ -6328,19 +6327,13 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
|||||||
{
|
{
|
||||||
// Compare the link implementation fallback link interface to the
|
// Compare the link implementation fallback link interface to the
|
||||||
// preferred new link interface property and warn if different.
|
// preferred new link interface property and warn if different.
|
||||||
cmGeneratorExpression ge;
|
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
|
||||||
"INTERFACE_LINK_LIBRARIES", 0, 0);
|
|
||||||
std::vector<std::string> ifaceLibs;
|
std::vector<std::string> ifaceLibs;
|
||||||
const char* newExplicitLibraries =
|
std::string newProp = "INTERFACE_LINK_LIBRARIES";
|
||||||
this->GetProperty("INTERFACE_LINK_LIBRARIES");
|
if(const char* newExplicitLibraries = this->GetProperty(newProp))
|
||||||
cmSystemTools::ExpandListArgument(
|
{
|
||||||
ge.Parse(newExplicitLibraries)->Evaluate(this->Makefile,
|
this->ExpandLinkItems(newProp, newExplicitLibraries, config,
|
||||||
config,
|
headTarget, ifaceLibs);
|
||||||
false,
|
}
|
||||||
headTarget,
|
|
||||||
this, &dagChecker),
|
|
||||||
ifaceLibs);
|
|
||||||
if (ifaceLibs != impl->Libraries)
|
if (ifaceLibs != impl->Libraries)
|
||||||
{
|
{
|
||||||
std::string oldLibraries;
|
std::string oldLibraries;
|
||||||
|
@ -764,6 +764,10 @@ private:
|
|||||||
void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
|
void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
|
|
||||||
|
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||||
|
std::string const& config, cmTarget const* headTarget,
|
||||||
|
std::vector<std::string>& libs) const;
|
||||||
|
|
||||||
std::string ProcessSourceItemCMP0049(const std::string& s);
|
std::string ProcessSourceItemCMP0049(const std::string& s);
|
||||||
|
|
||||||
void ClearLinkMaps();
|
void ClearLinkMaps();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user