Explorar el Código

cmGeneratorTarget: Move HasImportLibrary from cmTarget.

Stephen Kelly hace 10 años
padre
commit
526cc7dc52

+ 1 - 1
Source/cmGeneratorExpressionNode.cxx

@@ -1658,7 +1658,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
       return std::string();
       }
     return target->GetFullPath(context->Config,
-                               target->Target->HasImportLibrary());
+                               target->HasImportLibrary());
   }
 };
 

+ 9 - 1
Source/cmGeneratorTarget.cxx

@@ -5487,7 +5487,7 @@ cmGeneratorTarget::GetPDBDirectory(const std::string& config) const
 //----------------------------------------------------------------------------
 bool cmGeneratorTarget::HasImplibGNUtoMS() const
 {
-  return this->Target->HasImportLibrary()
+  return this->HasImportLibrary()
       && this->GetPropertyAsBool("GNUtoMS");
 }
 
@@ -5504,3 +5504,11 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
     }
   return false;
 }
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HasImportLibrary() const
+{
+  return (this->Target->IsDLLPlatform() &&
+          (this->GetType() == cmTarget::SHARED_LIBRARY ||
+           this->Target->IsExecutableWithExports()));
+}

+ 3 - 0
Source/cmGeneratorTarget.h

@@ -398,6 +398,9 @@ public:
   bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
                         const char* newExt = 0) const;
 
+  /** Return whether or not the target has a DLL import library.  */
+  bool HasImportLibrary() const;
+
   struct SourceFileFlags
   GetTargetSourceFileFlags(const cmSourceFile* sf) const;
 

+ 1 - 1
Source/cmNinjaNormalTargetGenerator.cxx

@@ -559,7 +559,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                                               cmLocalGenerator::SHELL);
     vars["TARGET_IMPLIB"] = impLibPath;
     EnsureParentDirectoryExists(impLibPath);
-    if(target.HasImportLibrary())
+    if(genTarget.HasImportLibrary())
       {
       byproducts.push_back(targetOutputImplib);
       }

+ 3 - 3
Source/cmTarget.h

@@ -262,9 +262,6 @@ public:
   /** Return whether or not the target is for a DLL platform.  */
   bool IsDLLPlatform() const { return this->DLLPlatform; }
 
-  /** Return whether or not the target has a DLL import library.  */
-  bool HasImportLibrary() const;
-
   /** Return whether this target is a shared library Framework on
       Apple.  */
   bool IsFrameworkOnApple() const;
@@ -463,6 +460,9 @@ private:
 
   void MaybeInvalidatePropertyCache(const std::string& prop);
 
+  /** Return whether or not the target has a DLL import library.  */
+  bool HasImportLibrary() const;
+
   // Internal representation details.
   friend class cmTargetInternals;
   friend class cmGeneratorTarget;