Merge topic 'refactor-link-internals'
24637979
cmTarget: Refactor ComputeLinkImplementation7812d2a9
cmTarget: Pre-indent a block in ComputeLinkImplementationf48d8bd6
cmTarget: Shorten a long line in ComputeLinkImplementation7b0834e9
cmTarget: Refactor internal LinkImplementation mapb8651d97
cmTarget: Remove unnecessary 'mutable' markup0192be51
cmTarget: De-duplicate link interface evaluation for $<LINK_ONLY>6ead631b
cmTarget: Teach GetLinkInterfaceLibraries to support $<LINK_ONLY>b030a7f1
cmTarget: De-duplicate link interface genex code for $<LINK_ONLY>1001490d
cmTarget: Teach ExpandLinkItems how to support $<LINK_ONLY>
This commit is contained in:
commit
55bba3a197
|
@ -126,11 +126,13 @@ public:
|
||||||
typedef std::map<TargetConfigPair, OptionalLinkInterface>
|
typedef std::map<TargetConfigPair, OptionalLinkInterface>
|
||||||
LinkInterfaceMapType;
|
LinkInterfaceMapType;
|
||||||
LinkInterfaceMapType LinkInterfaceMap;
|
LinkInterfaceMapType LinkInterfaceMap;
|
||||||
|
LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
|
||||||
bool PolicyWarnedCMP0022;
|
bool PolicyWarnedCMP0022;
|
||||||
|
|
||||||
typedef std::map<TargetConfigPair, cmTarget::LinkInterface>
|
typedef std::map<TargetConfigPair, cmTarget::LinkInterface>
|
||||||
ImportLinkInterfaceMapType;
|
ImportLinkInterfaceMapType;
|
||||||
ImportLinkInterfaceMapType ImportLinkInterfaceMap;
|
ImportLinkInterfaceMapType ImportLinkInterfaceMap;
|
||||||
|
ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap;
|
||||||
|
|
||||||
typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType;
|
typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType;
|
||||||
OutputInfoMapType OutputInfoMap;
|
OutputInfoMapType OutputInfoMap;
|
||||||
|
@ -142,8 +144,15 @@ public:
|
||||||
CompileInfoMapType CompileInfoMap;
|
CompileInfoMapType CompileInfoMap;
|
||||||
|
|
||||||
// Cache link implementation computation from each configuration.
|
// Cache link implementation computation from each configuration.
|
||||||
|
struct OptionalLinkImplementation: public cmTarget::LinkImplementation
|
||||||
|
{
|
||||||
|
OptionalLinkImplementation():
|
||||||
|
LibrariesDone(false), LanguagesDone(false) {}
|
||||||
|
bool LibrariesDone;
|
||||||
|
bool LanguagesDone;
|
||||||
|
};
|
||||||
typedef std::map<TargetConfigPair,
|
typedef std::map<TargetConfigPair,
|
||||||
cmTarget::LinkImplementation> LinkImplMapType;
|
OptionalLinkImplementation> LinkImplMapType;
|
||||||
LinkImplMapType LinkImplMap;
|
LinkImplMapType LinkImplMap;
|
||||||
|
|
||||||
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
|
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
|
||||||
|
@ -172,25 +181,25 @@ public:
|
||||||
std::vector<TargetPropertyEntry*> SourceEntries;
|
std::vector<TargetPropertyEntry*> SourceEntries;
|
||||||
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
||||||
|
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceIncludeDirectoriesEntries;
|
CachedLinkInterfaceIncludeDirectoriesEntries;
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceCompileOptionsEntries;
|
CachedLinkInterfaceCompileOptionsEntries;
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceCompileDefinitionsEntries;
|
CachedLinkInterfaceCompileDefinitionsEntries;
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceSourcesEntries;
|
CachedLinkInterfaceSourcesEntries;
|
||||||
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
std::map<std::string, std::vector<TargetPropertyEntry*> >
|
||||||
CachedLinkInterfaceCompileFeaturesEntries;
|
CachedLinkInterfaceCompileFeaturesEntries;
|
||||||
mutable std::map<std::string, std::vector<cmTarget const*> >
|
std::map<std::string, std::vector<cmTarget const*> >
|
||||||
CachedLinkImplementationClosure;
|
CachedLinkImplementationClosure;
|
||||||
|
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
|
std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
|
std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
|
std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
|
std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
|
std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
|
||||||
mutable std::map<std::string, bool> CacheLinkImplementationClosureDone;
|
std::map<std::string, bool> CacheLinkImplementationClosureDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -510,7 +519,9 @@ void cmTarget::ClearLinkMaps()
|
||||||
this->LinkImplementationLanguageIsContextDependent = true;
|
this->LinkImplementationLanguageIsContextDependent = true;
|
||||||
this->Internal->LinkImplMap.clear();
|
this->Internal->LinkImplMap.clear();
|
||||||
this->Internal->LinkInterfaceMap.clear();
|
this->Internal->LinkInterfaceMap.clear();
|
||||||
|
this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
|
||||||
this->Internal->ImportLinkInterfaceMap.clear();
|
this->Internal->ImportLinkInterfaceMap.clear();
|
||||||
|
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap.clear();
|
||||||
this->Internal->LinkClosureMap.clear();
|
this->Internal->LinkClosureMap.clear();
|
||||||
for (cmTargetLinkInformationMap::const_iterator it
|
for (cmTargetLinkInformationMap::const_iterator it
|
||||||
= this->LinkInformation.begin();
|
= this->LinkInformation.begin();
|
||||||
|
@ -3688,10 +3699,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,
|
||||||
|
@ -6032,7 +6048,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
// Imported targets have their own link interface.
|
// Imported targets have their own link interface.
|
||||||
if(this->IsImported())
|
if(this->IsImported())
|
||||||
{
|
{
|
||||||
return this->GetImportLinkInterface(config, head);
|
return this->GetImportLinkInterface(config, head, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link interfaces are not supported for executables that do not
|
// Link interfaces are not supported for executables that do not
|
||||||
|
@ -6053,7 +6069,8 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
// Compute the link interface for this configuration.
|
// Compute the link interface for this configuration.
|
||||||
cmTargetInternals::OptionalLinkInterface iface;
|
cmTargetInternals::OptionalLinkInterface iface;
|
||||||
iface.ExplicitLibraries =
|
iface.ExplicitLibraries =
|
||||||
this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists);
|
this->ComputeLinkInterfaceLibraries(config, iface, head, false,
|
||||||
|
iface.Exists);
|
||||||
if (iface.Exists)
|
if (iface.Exists)
|
||||||
{
|
{
|
||||||
this->Internal->ComputeLinkInterface(this, config, iface,
|
this->Internal->ComputeLinkInterface(this, config, iface,
|
||||||
|
@ -6076,12 +6093,13 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkInterface const*
|
cmTarget::LinkInterface const*
|
||||||
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
cmTarget const* head) const
|
cmTarget const* head,
|
||||||
|
bool usage_requirements_only) const
|
||||||
{
|
{
|
||||||
// Imported targets have their own link interface.
|
// Imported targets have their own link interface.
|
||||||
if(this->IsImported())
|
if(this->IsImported())
|
||||||
{
|
{
|
||||||
return this->GetImportLinkInterface(config, head);
|
return this->GetImportLinkInterface(config, head, usage_requirements_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link interfaces are not supported for executables that do not
|
// Link interfaces are not supported for executables that do not
|
||||||
|
@ -6094,21 +6112,24 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
|
|
||||||
// Lookup any existing link interface for this configuration.
|
// Lookup any existing link interface for this configuration.
|
||||||
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
||||||
|
cmTargetInternals::LinkInterfaceMapType& lim =
|
||||||
|
(usage_requirements_only ?
|
||||||
|
this->Internal->LinkInterfaceUsageRequirementsOnlyMap :
|
||||||
|
this->Internal->LinkInterfaceMap);
|
||||||
|
|
||||||
cmTargetInternals::LinkInterfaceMapType::iterator
|
cmTargetInternals::LinkInterfaceMapType::iterator i = lim.find(key);
|
||||||
i = this->Internal->LinkInterfaceMap.find(key);
|
if(i == lim.end())
|
||||||
if(i == this->Internal->LinkInterfaceMap.end())
|
|
||||||
{
|
{
|
||||||
// Compute the link interface for this configuration.
|
// Compute the link interface for this configuration.
|
||||||
cmTargetInternals::OptionalLinkInterface iface;
|
cmTargetInternals::OptionalLinkInterface iface;
|
||||||
iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config,
|
iface.ExplicitLibraries =
|
||||||
iface,
|
this->ComputeLinkInterfaceLibraries(config, iface, head,
|
||||||
head,
|
usage_requirements_only,
|
||||||
iface.Exists);
|
iface.Exists);
|
||||||
|
|
||||||
// Store the information for this configuration.
|
// Store the information for this configuration.
|
||||||
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
|
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
|
||||||
i = this->Internal->LinkInterfaceMap.insert(entry).first;
|
i = lim.insert(entry).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second.Exists ? &i->second : 0;
|
return i->second.Exists ? &i->second : 0;
|
||||||
|
@ -6117,7 +6138,8 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTarget::LinkInterface const*
|
cmTarget::LinkInterface const*
|
||||||
cmTarget::GetImportLinkInterface(const std::string& config,
|
cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
cmTarget const* headTarget) const
|
cmTarget const* headTarget,
|
||||||
|
bool usage_requirements_only) const
|
||||||
{
|
{
|
||||||
cmTarget::ImportInfo const* info = this->GetImportInfo(config);
|
cmTarget::ImportInfo const* info = this->GetImportInfo(config);
|
||||||
if(!info)
|
if(!info)
|
||||||
|
@ -6126,16 +6148,20 @@ cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config));
|
||||||
|
cmTargetInternals::ImportLinkInterfaceMapType& lim =
|
||||||
|
(usage_requirements_only ?
|
||||||
|
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap :
|
||||||
|
this->Internal->ImportLinkInterfaceMap);
|
||||||
|
|
||||||
cmTargetInternals::ImportLinkInterfaceMapType::iterator i =
|
cmTargetInternals::ImportLinkInterfaceMapType::iterator i = lim.find(key);
|
||||||
this->Internal->ImportLinkInterfaceMap.find(key);
|
if(i == lim.end())
|
||||||
if(i == this->Internal->ImportLinkInterfaceMap.end())
|
|
||||||
{
|
{
|
||||||
LinkInterface iface;
|
LinkInterface iface;
|
||||||
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, usage_requirements_only,
|
||||||
|
iface.Libraries);
|
||||||
{
|
{
|
||||||
std::vector<std::string> deps;
|
std::vector<std::string> deps;
|
||||||
cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
|
cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
|
||||||
|
@ -6144,7 +6170,7 @@ cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
|
|
||||||
cmTargetInternals::ImportLinkInterfaceMapType::value_type
|
cmTargetInternals::ImportLinkInterfaceMapType::value_type
|
||||||
entry(key, iface);
|
entry(key, iface);
|
||||||
i = this->Internal->ImportLinkInterfaceMap.insert(entry).first;
|
i = lim.insert(entry).first;
|
||||||
}
|
}
|
||||||
return &i->second;
|
return &i->second;
|
||||||
}
|
}
|
||||||
|
@ -6160,7 +6186,7 @@ void processILibs(const std::string& config,
|
||||||
{
|
{
|
||||||
tgts.push_back(item.Target);
|
tgts.push_back(item.Target);
|
||||||
if(cmTarget::LinkInterface const* iface =
|
if(cmTarget::LinkInterface const* iface =
|
||||||
item.Target->GetLinkInterfaceLibraries(config, headTarget))
|
item.Target->GetLinkInterfaceLibraries(config, headTarget, false))
|
||||||
{
|
{
|
||||||
for(std::vector<cmLinkItem>::const_iterator
|
for(std::vector<cmLinkItem>::const_iterator
|
||||||
it = iface->Libraries.begin();
|
it = iface->Libraries.begin();
|
||||||
|
@ -6200,15 +6226,18 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
std::vector<cmTarget const*> &tgts) const
|
std::vector<cmTarget const*> &tgts) const
|
||||||
{
|
{
|
||||||
cmTarget::LinkInterface const* iface
|
// The $<LINK_ONLY> expression may be in a link interface to specify private
|
||||||
= this->GetLinkInterfaceLibraries(config, headTarget);
|
// link dependencies that are otherwise excluded from usage requirements.
|
||||||
if (!iface)
|
// Currently $<LINK_ONLY> is internal to CMake and only ever added by
|
||||||
{
|
// target_link_libraries for PRIVATE dependencies of STATIC libraries in
|
||||||
return;
|
// INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior.
|
||||||
}
|
bool usage_requirements_only =
|
||||||
if(this->GetType() != STATIC_LIBRARY
|
this->GetType() == STATIC_LIBRARY &&
|
||||||
|| this->GetPolicyStatusCMP0022() == cmPolicies::WARN
|
this->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
|
||||||
|| this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
|
this->GetPolicyStatusCMP0022() != cmPolicies::OLD;
|
||||||
|
if(cmTarget::LinkInterface const* iface =
|
||||||
|
this->GetLinkInterfaceLibraries(config, headTarget,
|
||||||
|
usage_requirements_only))
|
||||||
{
|
{
|
||||||
for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin();
|
for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin();
|
||||||
it != iface->Libraries.end(); ++it)
|
it != iface->Libraries.end(); ++it)
|
||||||
|
@ -6218,37 +6247,6 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
|
||||||
tgts.push_back(it->Target);
|
tgts.push_back(it->Target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
|
|
||||||
const char* interfaceLibs = this->GetProperty(linkIfaceProp);
|
|
||||||
|
|
||||||
if (!interfaceLibs)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The interface libraries have been explicitly set.
|
|
||||||
cmGeneratorExpression ge;
|
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
|
||||||
linkIfaceProp, 0, 0);
|
|
||||||
dagChecker.SetTransitivePropertiesOnly();
|
|
||||||
std::vector<std::string> libs;
|
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
|
|
||||||
this->Makefile,
|
|
||||||
config,
|
|
||||||
false,
|
|
||||||
headTarget,
|
|
||||||
this, &dagChecker), libs);
|
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it = libs.begin();
|
|
||||||
it != libs.end(); ++it)
|
|
||||||
{
|
|
||||||
if (cmTarget const* tgt = this->FindTargetToLink(*it))
|
|
||||||
{
|
|
||||||
tgts.push_back(tgt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6256,6 +6254,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
|
||||||
const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
LinkInterface& iface,
|
LinkInterface& iface,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
|
bool usage_requirements_only,
|
||||||
bool &exists) const
|
bool &exists) const
|
||||||
{
|
{
|
||||||
// Construct the property name suffix for this configuration.
|
// Construct the property name suffix for this configuration.
|
||||||
|
@ -6341,7 +6340,8 @@ 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, usage_requirements_only,
|
||||||
|
iface.Libraries);
|
||||||
}
|
}
|
||||||
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|
||||||
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
|
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
|
||||||
|
@ -6355,7 +6355,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
this->GetLinkImplementationLibrariesInternal(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 && !usage_requirements_only)
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
|
@ -6364,7 +6364,8 @@ 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, usage_requirements_only,
|
||||||
|
ifaceLibs);
|
||||||
}
|
}
|
||||||
if (ifaceLibs != impl->Libraries)
|
if (ifaceLibs != impl->Libraries)
|
||||||
{
|
{
|
||||||
|
@ -6525,28 +6526,21 @@ cmTarget::GetLinkImplementation(const std::string& config) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup any existing link implementation for this configuration.
|
// Populate the link implementation for this configuration.
|
||||||
TargetConfigPair key(this, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(this, cmSystemTools::UpperCase(config));
|
||||||
|
cmTargetInternals::OptionalLinkImplementation&
|
||||||
cmTargetInternals::LinkImplMapType::iterator
|
impl = this->Internal->LinkImplMap[key];
|
||||||
i = this->Internal->LinkImplMap.find(key);
|
if(!impl.LibrariesDone)
|
||||||
if(i == this->Internal->LinkImplMap.end())
|
|
||||||
{
|
{
|
||||||
// Compute the link implementation for this configuration.
|
impl.LibrariesDone = true;
|
||||||
LinkImplementation impl;
|
|
||||||
this->ComputeLinkImplementation(config, impl, this);
|
this->ComputeLinkImplementation(config, impl, this);
|
||||||
this->ComputeLinkImplementationLanguages(config, impl, this);
|
|
||||||
|
|
||||||
// Store the information for this configuration.
|
|
||||||
cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
|
|
||||||
i = this->Internal->LinkImplMap.insert(entry).first;
|
|
||||||
}
|
}
|
||||||
else if (i->second.Languages.empty())
|
if(!impl.LanguagesDone)
|
||||||
{
|
{
|
||||||
this->ComputeLinkImplementationLanguages(config, i->second, this);
|
impl.LanguagesDone = true;
|
||||||
|
this->ComputeLinkImplementationLanguages(config, impl, this);
|
||||||
}
|
}
|
||||||
|
return &impl;
|
||||||
return &i->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -6567,23 +6561,16 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup any existing link implementation for this configuration.
|
// Populate the link implementation libraries for this configuration.
|
||||||
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
||||||
|
cmTargetInternals::OptionalLinkImplementation&
|
||||||
cmTargetInternals::LinkImplMapType::iterator
|
impl = this->Internal->LinkImplMap[key];
|
||||||
i = this->Internal->LinkImplMap.find(key);
|
if(!impl.LibrariesDone)
|
||||||
if(i == this->Internal->LinkImplMap.end())
|
|
||||||
{
|
{
|
||||||
// Compute the link implementation for this configuration.
|
impl.LibrariesDone = true;
|
||||||
LinkImplementation impl;
|
this->ComputeLinkImplementation(config, impl, this);
|
||||||
this->ComputeLinkImplementation(config, impl, head);
|
|
||||||
|
|
||||||
// Store the information for this configuration.
|
|
||||||
cmTargetInternals::LinkImplMapType::value_type entry(key, impl);
|
|
||||||
i = this->Internal->LinkImplMap.insert(entry).first;
|
|
||||||
}
|
}
|
||||||
|
return &impl;
|
||||||
return &i->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -6592,15 +6579,18 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
|
||||||
cmTarget const* head) const
|
cmTarget const* head) const
|
||||||
{
|
{
|
||||||
// Collect libraries directly linked in this configuration.
|
// Collect libraries directly linked in this configuration.
|
||||||
std::vector<std::string> llibs;
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
||||||
if(const char *prop = this->GetProperty("LINK_LIBRARIES"))
|
le = this->Internal->LinkImplementationPropertyEntries.begin(),
|
||||||
|
end = this->Internal->LinkImplementationPropertyEntries.end();
|
||||||
|
le != end; ++le)
|
||||||
{
|
{
|
||||||
cmGeneratorExpression ge;
|
std::vector<std::string> llibs;
|
||||||
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
|
|
||||||
|
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(
|
cmGeneratorExpressionDAGChecker dagChecker(
|
||||||
this->GetName(),
|
this->GetName(),
|
||||||
"LINK_LIBRARIES", 0, 0);
|
"LINK_LIBRARIES", 0, 0);
|
||||||
|
cmGeneratorExpression ge(&le->Backtrace);
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
||||||
|
ge.Parse(le->Value);
|
||||||
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
|
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile,
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
|
@ -6608,6 +6598,55 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
|
||||||
&dagChecker),
|
&dagChecker),
|
||||||
llibs);
|
llibs);
|
||||||
|
|
||||||
|
for(std::vector<std::string>::const_iterator li = llibs.begin();
|
||||||
|
li != llibs.end(); ++li)
|
||||||
|
{
|
||||||
|
// Skip entries that resolve to the target itself or are empty.
|
||||||
|
std::string name = this->CheckCMP0004(*li);
|
||||||
|
if(name == this->GetName() || name.empty())
|
||||||
|
{
|
||||||
|
if(name == this->GetName())
|
||||||
|
{
|
||||||
|
bool noMessage = false;
|
||||||
|
cmake::MessageType messageType = cmake::FATAL_ERROR;
|
||||||
|
cmOStringStream e;
|
||||||
|
switch(this->GetPolicyStatusCMP0038())
|
||||||
|
{
|
||||||
|
case cmPolicies::WARN:
|
||||||
|
{
|
||||||
|
e << (this->Makefile->GetPolicies()
|
||||||
|
->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
|
||||||
|
messageType = cmake::AUTHOR_WARNING;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case cmPolicies::OLD:
|
||||||
|
noMessage = true;
|
||||||
|
case cmPolicies::REQUIRED_IF_USED:
|
||||||
|
case cmPolicies::REQUIRED_ALWAYS:
|
||||||
|
case cmPolicies::NEW:
|
||||||
|
// Issue the fatal message.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!noMessage)
|
||||||
|
{
|
||||||
|
e << "Target \"" << this->GetName() << "\" links to itself.";
|
||||||
|
this->Makefile->GetCMakeInstance()->IssueMessage(
|
||||||
|
messageType, e.str(), this->GetBacktrace());
|
||||||
|
if (messageType == cmake::FATAL_ERROR)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The entry is meant for this configuration.
|
||||||
|
impl.Libraries.push_back(
|
||||||
|
cmLinkItem(name, this->FindTargetToLink(name)));
|
||||||
|
}
|
||||||
|
|
||||||
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
|
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
|
||||||
for (std::set<std::string>::const_iterator it = seenProps.begin();
|
for (std::set<std::string>::const_iterator it = seenProps.begin();
|
||||||
it != seenProps.end(); ++it)
|
it != seenProps.end(); ++it)
|
||||||
|
@ -6620,56 +6659,6 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
|
||||||
cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards);
|
cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator li = llibs.begin();
|
|
||||||
li != llibs.end(); ++li)
|
|
||||||
{
|
|
||||||
// Skip entries that resolve to the target itself or are empty.
|
|
||||||
std::string name = this->CheckCMP0004(*li);
|
|
||||||
if(name == this->GetName() || name.empty())
|
|
||||||
{
|
|
||||||
if(name == this->GetName())
|
|
||||||
{
|
|
||||||
bool noMessage = false;
|
|
||||||
cmake::MessageType messageType = cmake::FATAL_ERROR;
|
|
||||||
cmOStringStream e;
|
|
||||||
switch(this->GetPolicyStatusCMP0038())
|
|
||||||
{
|
|
||||||
case cmPolicies::WARN:
|
|
||||||
{
|
|
||||||
e << (this->Makefile->GetPolicies()
|
|
||||||
->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
|
|
||||||
messageType = cmake::AUTHOR_WARNING;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
noMessage = true;
|
|
||||||
case cmPolicies::REQUIRED_IF_USED:
|
|
||||||
case cmPolicies::REQUIRED_ALWAYS:
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
// Issue the fatal message.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!noMessage)
|
|
||||||
{
|
|
||||||
e << "Target \"" << this->GetName() << "\" links to itself.";
|
|
||||||
this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
|
|
||||||
e.str(),
|
|
||||||
this->GetBacktrace());
|
|
||||||
if (messageType == cmake::FATAL_ERROR)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The entry is meant for this configuration.
|
|
||||||
impl.Libraries.push_back(
|
|
||||||
cmLinkItem(name, this->FindTargetToLink(name)));
|
|
||||||
}
|
|
||||||
|
|
||||||
cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
|
cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
|
||||||
LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries();
|
LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries();
|
||||||
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
|
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
|
||||||
|
|
|
@ -280,7 +280,8 @@ public:
|
||||||
LinkInterface const* GetLinkInterface(const std::string& config,
|
LinkInterface const* GetLinkInterface(const std::string& config,
|
||||||
cmTarget const* headTarget) const;
|
cmTarget const* headTarget) const;
|
||||||
LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
|
LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
|
||||||
cmTarget const* headTarget) const;
|
cmTarget const* headTarget,
|
||||||
|
bool usage_requirements_only) const;
|
||||||
void GetTransitivePropertyTargets(const std::string& config,
|
void GetTransitivePropertyTargets(const std::string& config,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget,
|
||||||
std::vector<cmTarget const*> &libs) const;
|
std::vector<cmTarget const*> &libs) const;
|
||||||
|
@ -756,12 +757,13 @@ private:
|
||||||
const std::string& config) const;
|
const std::string& config) const;
|
||||||
|
|
||||||
LinkInterface const*
|
LinkInterface const*
|
||||||
GetImportLinkInterface(const std::string& config,
|
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
||||||
cmTarget const* head) const;
|
bool usage_requirements_only) const;
|
||||||
|
|
||||||
const char* ComputeLinkInterfaceLibraries(const std::string& config,
|
const char* ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
LinkInterface& iface,
|
LinkInterface& iface,
|
||||||
cmTarget const* head,
|
cmTarget const* head,
|
||||||
|
bool usage_requirements_only,
|
||||||
bool &exists) const;
|
bool &exists) const;
|
||||||
|
|
||||||
LinkImplementation const*
|
LinkImplementation const*
|
||||||
|
@ -777,6 +779,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;
|
||||||
|
|
Loading…
Reference in New Issue