From 7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 4 Aug 2015 19:19:44 +0200 Subject: [PATCH] cmGeneratorTarget: Move GetLinkImplementationClosure --- Source/cmGeneratorTarget.cxx | 54 ++++++++++++++++++++++++++++++++++-- Source/cmGeneratorTarget.h | 12 ++++++++ Source/cmTarget.cxx | 54 ------------------------------------ Source/cmTarget.h | 3 -- 4 files changed, 63 insertions(+), 60 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 521a5b744..f9f23a6da 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -618,7 +618,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, } std::vector const& deps = - this->Target->GetLinkImplementationClosure(config); + this->GetLinkImplementationClosure(config); for(std::vector::const_iterator li = deps.begin(), le = deps.end(); li != le; ++li) { @@ -774,6 +774,54 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector &result, result); } +//---------------------------------------------------------------------------- +void processILibs(const std::string& config, + cmTarget const* headTarget, + cmLinkItem const& item, + std::vector& tgts, + std::set& emitted) +{ + if (item.Target && emitted.insert(item.Target).second) + { + tgts.push_back(item.Target); + if(cmTarget::LinkInterfaceLibraries const* iface = + item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) + { + for(std::vector::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); + } + } + } +} + +//---------------------------------------------------------------------------- +const std::vector& +cmGeneratorTarget::GetLinkImplementationClosure( + const std::string& config) const +{ + LinkImplClosure& tgts = + this->LinkImplClosureMap[config]; + if(!tgts.Done) + { + tgts.Done = true; + std::set emitted; + + cmTarget::LinkImplementationLibraries const* impl + = this->Target->GetLinkImplementationLibraries(config); + + for(std::vector::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + processILibs(config, this->Target, *it, tgts , emitted); + } + } + return tgts; +} + //---------------------------------------------------------------------------- class cmTargetTraceDependencies { @@ -1455,7 +1503,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); compat.PropsString.insert("AUTOUIC_OPTIONS"); std::vector const& deps = - this->Target->GetLinkImplementationClosure(config); + this->GetLinkImplementationClosure(config); for(std::vector::const_iterator li = deps.begin(); li != deps.end(); ++li) { @@ -1954,7 +2002,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, || (!impliedByUse && !explicitlySet)); std::vector const& deps = - tgt->Target->GetLinkImplementationClosure(config); + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8e68d39e7..1303ee410 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -245,6 +245,18 @@ private: cmGeneratorTarget(cmGeneratorTarget const&); void operator=(cmGeneratorTarget const&); + + struct LinkImplClosure: public std::vector + { + LinkImplClosure(): Done(false) {} + bool Done; + }; + mutable std::map LinkImplClosureMap; + +public: + std::vector const& + GetLinkImplementationClosure(const std::string& config) const; + }; struct cmStrictTargetComparison { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 968bd9d07..ded5363c1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -163,13 +163,6 @@ public: typedef std::map LinkClosureMapType; LinkClosureMapType LinkClosureMap; - struct LinkImplClosure: public std::vector - { - LinkImplClosure(): Done(false) {} - bool Done; - }; - std::map LinkImplClosureMap; - typedef std::map > SourceFilesMapType; SourceFilesMapType SourceFilesMap; @@ -5174,53 +5167,6 @@ cmTarget::GetImportLinkInterface(const std::string& config, return &iface; } -//---------------------------------------------------------------------------- -void processILibs(const std::string& config, - cmTarget const* headTarget, - cmLinkItem const& item, - std::vector& tgts, - std::set& emitted) -{ - if (item.Target && emitted.insert(item.Target).second) - { - tgts.push_back(item.Target); - if(cmTarget::LinkInterfaceLibraries const* iface = - item.Target->GetLinkInterfaceLibraries(config, headTarget, true)) - { - for(std::vector::const_iterator - it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); - } - } - } -} - -//---------------------------------------------------------------------------- -std::vector const& -cmTarget::GetLinkImplementationClosure(const std::string& config) const -{ - cmTargetInternals::LinkImplClosure& tgts = - this->Internal->LinkImplClosureMap[config]; - if(!tgts.Done) - { - tgts.Done = true; - std::set emitted; - - cmTarget::LinkImplementationLibraries const* impl - = this->GetLinkImplementationLibraries(config); - - for(std::vector::const_iterator - it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - processILibs(config, this, *it, tgts , emitted); - } - } - return tgts; -} - //---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterfaceLibraries( diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 85d99645c..925e7c6c8 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -293,9 +293,6 @@ public: cmTarget const* headTarget, bool usage_requirements_only) const; - std::vector const& - GetLinkImplementationClosure(const std::string& config) const; - /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ struct LinkImplementationLibraries