diff options
author | Brad King <brad.king@kitware.com> | 2014-06-12 20:22:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-06-23 13:17:00 (GMT) |
commit | 0dc9e88d76fa74440fc3b38032738a21ce72f2d7 (patch) | |
tree | 5ba1a5691a912da3790f68827d89e6cae3fe6453 /Source/cmTarget.cxx | |
parent | 4ac72455fd7027039d498f007fdfe7c1d819b9f9 (diff) | |
download | CMake-0dc9e88d76fa74440fc3b38032738a21ce72f2d7.zip CMake-0dc9e88d76fa74440fc3b38032738a21ce72f2d7.tar.gz CMake-0dc9e88d76fa74440fc3b38032738a21ce72f2d7.tar.bz2 |
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.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f380052..86cab4e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1198,8 +1198,15 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const //---------------------------------------------------------------------------- void cmTarget::GetDirectLinkLibraries(const std::string& config, - std::vector<std::string> &libs, - cmTarget const* head) const + std::vector<std::string> &libs) 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"); if (prop) @@ -2273,8 +2280,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const if(this->Makefile->IsOn("APPLE")) { - LinkImplementation const* impl = this->GetLinkImplementation(config, - this); + LinkImplementation const* impl = this->GetLinkImplementation(config); for(std::vector<std::string>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) @@ -3632,7 +3638,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, { // Get languages built in this target. 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(); li != impl->Languages.end(); ++li) { @@ -4500,7 +4506,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const return false; } std::vector<std::string> libs; - this->GetDirectLinkLibraries(config, libs, this); + this->GetDirectLinkLibraries(config, libs); return !libs.empty(); } @@ -6151,7 +6157,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const std::set<cmTarget*> emitted; cmTarget::LinkImplementation const* impl - = this->GetLinkImplementationLibraries(config, this); + = this->GetLinkImplementationLibraries(config); for(std::vector<std::string>::const_iterator it = impl->Libraries.begin(); 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. LinkImplementation const* impl = - this->GetLinkImplementationLibraries(config, headTarget); + this->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries = impl->Libraries; if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022) @@ -6407,7 +6413,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY) { cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget); + thisTarget->GetLinkImplementation(config); for(std::vector<std::string>::const_iterator 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. cmTarget::LinkImplementation const* - impl = thisTarget->GetLinkImplementation(config, headTarget); + impl = thisTarget->GetLinkImplementationLibrariesInternal(config, + headTarget); iface.ImplementationIsInterface = true; iface.WrongConfigLibraries = impl->WrongConfigLibraries; } @@ -6447,7 +6454,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Targets using this archive need its language runtime libraries. if(cmTarget::LinkImplementation const* impl = - thisTarget->GetLinkImplementation(config, headTarget)) + thisTarget->GetLinkImplementation(config)) { iface.Languages = impl->Languages; } @@ -6485,8 +6492,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementation(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementation(const std::string& config) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -6495,7 +6501,7 @@ cmTarget::GetLinkImplementation(const std::string& config, } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + TargetConfigPair key(this, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -6503,8 +6509,8 @@ cmTarget::GetLinkImplementation(const std::string& config, { // Compute the link implementation for this configuration. LinkImplementation impl; - this->ComputeLinkImplementation(config, impl, head); - this->ComputeLinkImplementationLanguages(config, impl, head); + this->ComputeLinkImplementation(config, impl, this); + this->ComputeLinkImplementationLanguages(config, impl, this); // Store the information for this configuration. cmTargetInternals::LinkImplMapType::value_type entry(key, impl); @@ -6512,7 +6518,7 @@ cmTarget::GetLinkImplementation(const std::string& config, } else if (i->second.Languages.empty()) { - this->ComputeLinkImplementationLanguages(config, i->second, head); + this->ComputeLinkImplementationLanguages(config, i->second, this); } return &i->second; @@ -6520,8 +6526,15 @@ cmTarget::GetLinkImplementation(const std::string& config, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementationLibraries(const std::string& config, - cmTarget const* head) const +cmTarget::GetLinkImplementationLibraries(const std::string& config) 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. if(this->IsImported()) @@ -6555,7 +6568,7 @@ void cmTarget::ComputeLinkImplementation(const std::string& config, { // Collect libraries directly linked in this configuration. 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(); li != llibs.end(); ++li) { |