Przeglądaj źródła

cmGeneratorTarget: Move GetLinkImplementationClosure

Stephen Kelly 10 lat temu
rodzic
commit
7da4c9d4ed
4 zmienionych plików z 63 dodań i 60 usunięć
  1. 51 3
      Source/cmGeneratorTarget.cxx
  2. 12 0
      Source/cmGeneratorTarget.h
  3. 0 54
      Source/cmTarget.cxx
  4. 0 3
      Source/cmTarget.h

+ 51 - 3
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)
       {
@@ -774,6 +774,54 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
                                   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
 {
@@ -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())
     {

+ 12 - 0
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 {

+ 0 - 54
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;
@@ -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<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(

+ 0 - 3
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