diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-26 17:38:37 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-26 17:38:37 (GMT) |
commit | 0db9d9278760c90be1fbf5c4eeb93ef9c524041a (patch) | |
tree | c385286a2a7452078b46e847e717eb8b89fb143e | |
parent | 84b847e42fde288bc102198aedeb68e19b41ef1e (diff) | |
download | CMake-0db9d9278760c90be1fbf5c4eeb93ef9c524041a.zip CMake-0db9d9278760c90be1fbf5c4eeb93ef9c524041a.tar.gz CMake-0db9d9278760c90be1fbf5c4eeb93ef9c524041a.tar.bz2 |
cmGeneratorTarget: Move GetLinkInterfaceLibraries from cmTarget.
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 56 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 5 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 44 | ||||
-rw-r--r-- | Source/cmTarget.h | 5 |
5 files changed, 59 insertions, 53 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 9509c2b..31b6766 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1109,7 +1109,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if(isInterfaceProperty) { if(cmLinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) + gtgt->GetLinkInterfaceLibraries(context->Config, headTarget, true)) { linkedTargetsContent = getLinkedTargetsContent(iface->Libraries, target, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 058a120..2489c99 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1507,20 +1507,22 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result, void processILibs(const std::string& config, cmTarget const* headTarget, cmLinkItem const& item, + cmGlobalGenerator* gg, std::vector<cmTarget const*>& tgts, std::set<cmTarget const*>& emitted) { if (item.Target && emitted.insert(item.Target).second) { tgts.push_back(item.Target); + cmGeneratorTarget* gt = gg->GetGeneratorTarget(item.Target); if(cmLinkInterfaceLibraries const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) + gt->GetLinkInterfaceLibraries(config, headTarget, true)) { for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) { - processILibs(config, headTarget, *it, tgts, emitted); + processILibs(config, headTarget, *it, gg, tgts, emitted); } } } @@ -1545,7 +1547,9 @@ cmGeneratorTarget::GetLinkImplementationClosure( it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { - processILibs(config, this->Target, *it, tgts , emitted); + processILibs(config, this->Target, *it, + this->LocalGenerator->GetGlobalGenerator(), + tgts , emitted); } } return tgts; @@ -3503,3 +3507,49 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config, } } } + +//---------------------------------------------------------------------------- +const cmLinkInterfaceLibraries * +cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config, + cmTarget const* head, + bool usage_requirements_only) const +{ + // Imported targets have their own link interface. + if(this->IsImported()) + { + return this->Target->GetImportLinkInterface(config, head, + usage_requirements_only); + } + + // Link interfaces are not supported for executables that do not + // export symbols. + if(this->GetType() == cmTarget::EXECUTABLE && + !this->Target->IsExecutableWithExports()) + { + return 0; + } + + // Lookup any existing link interface for this configuration. + std::string CONFIG = cmSystemTools::UpperCase(config); + cmHeadToLinkInterfaceMap& hm = + (usage_requirements_only ? + this->Target->GetHeadToLinkInterfaceUsageRequirementsMap(config) : + this->Target->GetHeadToLinkInterfaceMap(config)); + + // If the link interface does not depend on the head target + // then return the one we computed first. + if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) + { + return &hm.begin()->second; + } + + cmOptionalLinkInterface& iface = hm[head]; + if(!iface.LibrariesDone) + { + iface.LibrariesDone = true; + this->Target->ComputeLinkInterfaceLibraries( + config, iface, head, usage_requirements_only); + } + + return iface.Exists? &iface : 0; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 282ab89..43fcb4a 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -112,6 +112,11 @@ public: cmOptionalLinkInterface& iface, cmTarget const* head) const; + cmLinkInterfaceLibraries const* + GetLinkInterfaceLibraries(const std::string& config, + cmTarget const* headTarget, + bool usage_requirements_only) const; + /** Get the full path to the target according to the settings in its makefile and the configuration type. */ std::string GetFullPath(const std::string& config="", bool implib = false, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c8a9148..00dbc6a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4107,50 +4107,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } } -//---------------------------------------------------------------------------- -const cmLinkInterfaceLibraries * -cmTarget::GetLinkInterfaceLibraries(const std::string& config, - cmTarget const* head, - bool usage_requirements_only) const -{ - // Imported targets have their own link interface. - if(this->IsImported()) - { - return this->GetImportLinkInterface(config, head, usage_requirements_only); - } - - // Link interfaces are not supported for executables that do not - // export symbols. - if(this->GetType() == cmTarget::EXECUTABLE && - !this->IsExecutableWithExports()) - { - return 0; - } - - // Lookup any existing link interface for this configuration. - cmHeadToLinkInterfaceMap& hm = - (usage_requirements_only ? - this->GetHeadToLinkInterfaceUsageRequirementsMap(config) : - this->GetHeadToLinkInterfaceMap(config)); - - // If the link interface does not depend on the head target - // then return the one we computed first. - if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) - { - return &hm.begin()->second; - } - - cmOptionalLinkInterface& iface = hm[head]; - if(!iface.LibrariesDone) - { - iface.LibrariesDone = true; - this->ComputeLinkInterfaceLibraries( - config, iface, head, usage_requirements_only); - } - - return iface.Exists? &iface : 0; -} - cmHeadToLinkInterfaceMap& cmTarget::GetHeadToLinkInterfaceMap(const std::string &config) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e71820e..f124084 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -238,11 +238,6 @@ public: cmTarget const* head, bool usage_requirements_only) const; - cmLinkInterfaceLibraries const* - GetLinkInterfaceLibraries(const std::string& config, - cmTarget const* headTarget, - bool usage_requirements_only) const; - cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceMap(std::string const& config) const; cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap( |