Browse Source

cmGeneratorTarget: Move HasSOName from cmTarget.

Stephen Kelly 10 years ago
parent
commit
f0aa660772

+ 1 - 1
Source/cmExportFileGenerator.cxx

@@ -889,7 +889,7 @@ cmExportFileGenerator
       {
       std::string prop;
       std::string value;
-      if(target->Target->HasSOName(config))
+      if(target->HasSOName(config))
         {
         if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
           {

+ 13 - 1
Source/cmGeneratorTarget.cxx

@@ -656,6 +656,18 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
   this->Target->GetSourceFiles(files, config);
 }
 
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HasSOName(const std::string& config) const
+{
+  // soname is supported only for shared libraries and modules,
+  // and then only when the platform supports an soname flag.
+  return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
+           this->GetType() == cmTarget::MODULE_LIBRARY) &&
+          !this->GetPropertyAsBool("NO_SONAME") &&
+          this->Makefile->GetSONameFlag(
+            this->Target->GetLinkerLanguage(config)));
+}
+
 //----------------------------------------------------------------------------
 std::string cmGeneratorTarget::GetSOName(const std::string& config) const
 {
@@ -1407,7 +1419,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
   // Check for library version properties.
   const char* version = this->GetProperty("VERSION");
   const char* soversion = this->GetProperty("SOVERSION");
-  if(!this->Target->HasSOName(config) ||
+  if(!this->HasSOName(config) ||
      this->Target->IsFrameworkOnApple())
     {
     // Versioning is supported only for shared libraries and modules,

+ 3 - 0
Source/cmGeneratorTarget.h

@@ -160,6 +160,9 @@ public:
   std::vector<cmSourceFile*> const*
   GetSourceDepends(cmSourceFile const* sf) const;
 
+  /** Whether this library has soname enabled and platform supports it.  */
+  bool HasSOName(const std::string& config) const;
+
   /**
    * Flags for a given source file as used in this target. Typically assigned
    * via SET_TARGET_PROPERTIES when the property is a list of source files.

+ 1 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -1944,7 +1944,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   const char* version = target.GetProperty("VERSION");
   const char* soversion = target.GetProperty("SOVERSION");
-  if(!target.HasSOName(configName) || target.IsFrameworkOnApple())
+  if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
     {
     version = 0;
     soversion = 0;

+ 1 - 1
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -653,7 +653,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   vars.Target = target.c_str();
   vars.LinkLibraries = linkLibs.c_str();
   vars.ObjectsQuoted = buildObjs.c_str();
-  if (this->Target->HasSOName(this->ConfigName))
+  if (this->GeneratorTarget->HasSOName(this->ConfigName))
     {
     vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
     vars.TargetSOName= targetNameSO.c_str();

+ 1 - 1
Source/cmNinjaNormalTargetGenerator.cxx

@@ -531,7 +531,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     vars["LANGUAGE_COMPILE_FLAGS"] = t;
     }
 
-  if (target.HasSOName(cfgName))
+  if (this->GetGeneratorTarget()->HasSOName(cfgName))
     {
     vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
     vars["SONAME"] = this->TargetNameSO;

+ 0 - 11
Source/cmTarget.cxx

@@ -3534,17 +3534,6 @@ std::string cmTarget::GetCompilePDBPath(const std::string& config) const
   return dir + name;
 }
 
-//----------------------------------------------------------------------------
-bool cmTarget::HasSOName(const std::string& config) const
-{
-  // soname is supported only for shared libraries and modules,
-  // and then only when the platform supports an soname flag.
-  return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
-           this->GetType() == cmTarget::MODULE_LIBRARY) &&
-          !this->GetPropertyAsBool("NO_SONAME") &&
-          this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
-}
-
 //----------------------------------------------------------------------------
 bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
 {

+ 0 - 3
Source/cmTarget.h

@@ -386,9 +386,6 @@ public:
   /** Get the path for the MSVC /Fd option for this target.  */
   std::string GetCompilePDBPath(const std::string& config="") const;
 
-  /** Whether this library has soname enabled and platform supports it.  */
-  bool HasSOName(const std::string& config) const;
-
   /** Whether this library has \@rpath and platform supports it.  */
   bool HasMacOSXRpathInstallNameDir(const std::string& config) const;