summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-16 18:27:42 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-25 14:20:52 (GMT)
commit0192be51819f8765131fc059b3ee210011eb7b80 (patch)
tree52ea8a7ba437e97a078f98042ee18a103ba59cfb /Source
parent6ead631bf9ec6da8eeca5fb39e5eba80e5022f15 (diff)
downloadCMake-0192be51819f8765131fc059b3ee210011eb7b80.zip
CMake-0192be51819f8765131fc059b3ee210011eb7b80.tar.gz
CMake-0192be51819f8765131fc059b3ee210011eb7b80.tar.bz2
cmTarget: De-duplicate link interface evaluation for $<LINK_ONLY>
Teach GetTransitivePropertyTargets to use the GetLinkInterfaceLibraries method with usage_requirements_only==true instead of evaluating the INTERFACE_LINK_LIBRARIES property directly. This avoids duplicate evaluations and makes use of the caching done by GetLinkInterfaceLibraries.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx44
1 files changed, 12 insertions, 32 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 325357d..cb52e15 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6219,15 +6219,18 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget const*> &tgts) const
{
- cmTarget::LinkInterface const* iface
- = this->GetLinkInterfaceLibraries(config, headTarget, false);
- if (!iface)
- {
- return;
- }
- if(this->GetType() != STATIC_LIBRARY
- || this->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ // The $<LINK_ONLY> expression may be in a link interface to specify private
+ // link dependencies that are otherwise excluded from usage requirements.
+ // Currently $<LINK_ONLY> is internal to CMake and only ever added by
+ // target_link_libraries for PRIVATE dependencies of STATIC libraries in
+ // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior.
+ bool usage_requirements_only =
+ this->GetType() == STATIC_LIBRARY &&
+ this->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
+ 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();
it != iface->Libraries.end(); ++it)
@@ -6237,29 +6240,6 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
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.
- std::vector<cmLinkItem> libs;
- this->ExpandLinkItems(linkIfaceProp, interfaceLibs, config,
- headTarget, true, libs);
-
- for(std::vector<cmLinkItem>::const_iterator it = libs.begin();
- it != libs.end(); ++it)
- {
- if (it->Target)
- {
- tgts.push_back(it->Target);
- }
}
}