From 438d9c7c822f42c4fccd77a47b1a32f52a87e617 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Jul 2014 11:36:16 -0400 Subject: [PATCH] cmTarget: Re-order link interface map lookup logic In GetLinkInterface, GetLinkInterfaceLibraries, and GetImportLinkInterface, lookup the HeadToLinkInterfaceMap for the current configuration first, and then index it by head target. In GetLinkImplementationLibrariesInternal, lookup the HeadToLinkImplementationMap for the current configuration first, and then index it by head target. --- Source/cmTarget.cxx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 52b7e68c5..df65a68de 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5746,9 +5746,9 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface( // Lookup any existing link interface for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - - cmTargetInternals::OptionalLinkInterface& - iface = this->Internal->LinkInterfaceMap[CONFIG][head]; + cmTargetInternals::HeadToLinkInterfaceMap& hm = + this->Internal->LinkInterfaceMap[CONFIG]; + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5789,12 +5789,11 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config, // Lookup any existing link interface for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::LinkInterfaceMapType& lim = + cmTargetInternals::HeadToLinkInterfaceMap& hm = (usage_requirements_only ? - this->Internal->LinkInterfaceUsageRequirementsOnlyMap : - this->Internal->LinkInterfaceMap); - - cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][head]; + this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : + this->Internal->LinkInterfaceMap[CONFIG]); + cmTargetInternals::OptionalLinkInterface& iface = hm[head]; if(!iface.LibrariesDone) { iface.LibrariesDone = true; @@ -5817,13 +5816,12 @@ cmTarget::GetImportLinkInterface(const std::string& config, return 0; } - cmTargetInternals::LinkInterfaceMapType& lim = - (usage_requirements_only ? - this->Internal->LinkInterfaceUsageRequirementsOnlyMap : - this->Internal->LinkInterfaceMap); - std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::OptionalLinkInterface& iface = lim[CONFIG][headTarget]; + cmTargetInternals::HeadToLinkInterfaceMap& hm = + (usage_requirements_only ? + this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] : + this->Internal->LinkInterfaceMap[CONFIG]); + cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget]; if(!iface.AllDone) { iface.AllDone = true; @@ -6261,8 +6259,9 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, // Populate the link implementation libraries for this configuration. std::string CONFIG = cmSystemTools::UpperCase(config); - cmTargetInternals::OptionalLinkImplementation& - impl = this->Internal->LinkImplMap[CONFIG][head]; + cmTargetInternals::HeadToLinkImplementationMap& hm = + this->Internal->LinkImplMap[CONFIG]; + cmTargetInternals::OptionalLinkImplementation& impl = hm[head]; if(!impl.LibrariesDone) { impl.LibrariesDone = true;