diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 17:19:44 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-05 16:20:45 (GMT) |
commit | 7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4 (patch) | |
tree | 9abd84c4ef0bd0b1a7d9222db49174e7df5b5d5c | |
parent | 97f10e488a5153e45d6a27a730cc1ecbaae7d559 (diff) | |
download | CMake-7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4.zip CMake-7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4.tar.gz CMake-7da4c9d4edbdd6df6aa2a9467d6f32a98fc8cac4.tar.bz2 |
cmGeneratorTarget: Move GetLinkImplementationClosure
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 54 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 12 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 54 | ||||
-rw-r--r-- | Source/cmTarget.h | 3 |
4 files changed, 63 insertions, 60 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 521a5b7..f9f23a6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -618,7 +618,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, } std::vector<cmTarget const*> const& deps = - this->Target->GetLinkImplementationClosure(config); + this->GetLinkImplementationClosure(config); for(std::vector<cmTarget const*>::const_iterator li = deps.begin(), le = deps.end(); li != le; ++li) { @@ -775,6 +775,54 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result, } //---------------------------------------------------------------------------- +void processILibs(const std::string& config, + cmTarget const* headTarget, + cmLinkItem const& item, + std::vector<cmTarget const*>& tgts, + std::set<cmTarget const*>& 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<cmLinkItem>::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); + } + } + } +} + +//---------------------------------------------------------------------------- +const std::vector<const cmTarget*>& +cmGeneratorTarget::GetLinkImplementationClosure( + const std::string& config) const +{ + LinkImplClosure& tgts = + this->LinkImplClosureMap[config]; + if(!tgts.Done) + { + tgts.Done = true; + std::set<cmTarget const*> emitted; + + cmTarget::LinkImplementationLibraries const* impl + = this->Target->GetLinkImplementationLibraries(config); + + for(std::vector<cmLinkImplItem>::const_iterator + it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + processILibs(config, this->Target, *it, tgts , emitted); + } + } + return tgts; +} + +//---------------------------------------------------------------------------- class cmTargetTraceDependencies { public: @@ -1455,7 +1503,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); compat.PropsString.insert("AUTOUIC_OPTIONS"); std::vector<cmTarget const*> const& deps = - this->Target->GetLinkImplementationClosure(config); + this->GetLinkImplementationClosure(config); for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); li != deps.end(); ++li) { @@ -1954,7 +2002,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, || (!impliedByUse && !explicitlySet)); std::vector<cmTarget const*> const& deps = - tgt->Target->GetLinkImplementationClosure(config); + tgt->GetLinkImplementationClosure(config); if(deps.empty()) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8e68d39..1303ee4 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<cmTarget const*> + { + LinkImplClosure(): Done(false) {} + bool Done; + }; + mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap; + +public: + std::vector<cmTarget const*> const& + GetLinkImplementationClosure(const std::string& config) const; + }; struct cmStrictTargetComparison { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 968bd9d..ded5363 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -163,13 +163,6 @@ public: typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType; LinkClosureMapType LinkClosureMap; - struct LinkImplClosure: public std::vector<cmTarget const*> - { - LinkImplClosure(): Done(false) {} - bool Done; - }; - std::map<std::string, LinkImplClosure> LinkImplClosureMap; - typedef std::map<std::string, std::vector<cmSourceFile*> > SourceFilesMapType; SourceFilesMapType SourceFilesMap; @@ -5175,53 +5168,6 @@ cmTarget::GetImportLinkInterface(const std::string& config, } //---------------------------------------------------------------------------- -void processILibs(const std::string& config, - cmTarget const* headTarget, - cmLinkItem const& item, - std::vector<cmTarget const*>& tgts, - std::set<cmTarget const*>& 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<cmLinkItem>::const_iterator - it = iface->Libraries.begin(); - it != iface->Libraries.end(); ++it) - { - processILibs(config, headTarget, *it, tgts, emitted); - } - } - } -} - -//---------------------------------------------------------------------------- -std::vector<cmTarget const*> const& -cmTarget::GetLinkImplementationClosure(const std::string& config) const -{ - cmTargetInternals::LinkImplClosure& tgts = - this->Internal->LinkImplClosureMap[config]; - if(!tgts.Done) - { - tgts.Done = true; - std::set<cmTarget const*> emitted; - - cmTarget::LinkImplementationLibraries const* impl - = this->GetLinkImplementationLibraries(config); - - for(std::vector<cmLinkImplItem>::const_iterator - it = impl->Libraries.begin(); - it != impl->Libraries.end(); ++it) - { - processILibs(config, this, *it, tgts , emitted); - } - } - return tgts; -} - -//---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterfaceLibraries( cmTarget const* thisTarget, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 85d9964..925e7c6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -293,9 +293,6 @@ public: cmTarget const* headTarget, bool usage_requirements_only) const; - std::vector<cmTarget const*> 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 |