Pārlūkot izejas kodu

GenexEval: Add abstracted access to link interface for a target.

This can be extended with special handling for static libraries
so that we can process the link dependencies separately from the
usage dependencies.
Stephen Kelly 12 gadi atpakaļ
vecāks
revīzija
5aa9731c9f
3 mainītis faili ar 25 papildinājumiem un 5 dzēšanām
  1. 6 5
      Source/cmGeneratorExpressionEvaluator.cxx
  2. 16 0
      Source/cmTarget.cxx
  3. 3 0
      Source/cmTarget.h

+ 6 - 5
Source/cmGeneratorExpressionEvaluator.cxx

@@ -900,13 +900,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
     if (std::find_if(transBegin, transEnd,
               TransitiveWhitelistCompare(propertyName)) != transEnd)
       {
-      const cmTarget::LinkInterface *iface = target->GetLinkInterface(
-                                                    context->Config,
-                                                    headTarget);
-      if(iface)
+
+      std::vector<std::string> libs;
+      target->GetTransitivePropertyLinkLibraries(context->Config,
+                                                 headTarget, libs);
+      if (!libs.empty())
         {
         linkedTargetsContent =
-                  getLinkedTargetsContent(iface->Libraries, target,
+                  getLinkedTargetsContent(libs, target,
                                           headTarget,
                                           context, &dagChecker,
                                           interfacePropertyName);

+ 16 - 0
Source/cmTarget.cxx

@@ -6001,6 +6001,22 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
   return i->second.Exists? &i->second : 0;
 }
 
+//----------------------------------------------------------------------------
+void cmTarget::GetTransitivePropertyLinkLibraries(
+                                      const char* config,
+                                      cmTarget *headTarget,
+                                      std::vector<std::string> &libs)
+{
+  cmTarget::LinkInterface const* iface = this->GetLinkInterface(config,
+                                                                headTarget);
+  if (!iface)
+    {
+    return;
+    }
+
+  libs = iface->Libraries;
+}
+
 //----------------------------------------------------------------------------
 bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
                                     cmTarget *headTarget)

+ 3 - 0
Source/cmTarget.h

@@ -276,6 +276,9 @@ public:
       if the target cannot be linked.  */
   LinkInterface const* GetLinkInterface(const char* config,
                                         cmTarget *headTarget);
+  void GetTransitivePropertyLinkLibraries(const char* config,
+                                        cmTarget *headTarget,
+                                        std::vector<std::string> &libs);
 
   /** The link implementation specifies the direct library
       dependencies needed by the object files of the target.  */