Преглед изворни кода

cmGeneratorTarget: Move GetFrameworkVersion from cmTarget

Stephen Kelly пре 10 година
родитељ
комит
cf69630e51

+ 21 - 2
Source/cmGeneratorTarget.cxx

@@ -1641,7 +1641,7 @@ cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
   if(!rootDir && !this->Makefile->PlatformIsAppleIos())
     {
     fpath += "/Versions/";
-    fpath += this->Target->GetFrameworkVersion();
+    fpath += this->GetFrameworkVersion();
     }
   return fpath;
 }
@@ -3331,7 +3331,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
     if(!this->Makefile->PlatformIsAppleIos())
       {
       realName += "Versions/";
-      realName += this->Target->GetFrameworkVersion();
+      realName += this->GetFrameworkVersion();
       realName += "/";
       }
     realName += base;
@@ -4525,6 +4525,25 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion,
     }
 }
 
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetFrameworkVersion() const
+{
+  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+
+  if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
+    {
+    return fversion;
+    }
+  else if(const char* tversion = this->GetProperty("VERSION"))
+    {
+    return tversion;
+    }
+  else
+    {
+    return "A";
+    }
+}
+
 //----------------------------------------------------------------------------
 void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
                                     std::string const& prefix,

+ 4 - 0
Source/cmGeneratorTarget.h

@@ -165,6 +165,10 @@ public:
   std::string GetFrameworkDirectory(const std::string& config,
                                     bool rootDir) const;
 
+  /** Return the framework version string.  Undefined if
+      IsFrameworkOnApple returns false.  */
+  std::string GetFrameworkVersion() const;
+
   /** @return the Mac CFBundle directory without the base */
   std::string GetCFBundleDirectory(const std::string& config,
                                    bool contentOnly) const;

+ 1 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -2141,7 +2141,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
     {
     if(gtgt->GetPropertyAsBool("FRAMEWORK"))
       {
-      std::string fw_version = gtgt->Target->GetFrameworkVersion();
+      std::string fw_version = gtgt->GetFrameworkVersion();
       buildSettings->AddAttribute("FRAMEWORK_VERSION",
                                   this->CreateString(fw_version.c_str()));
 

+ 1 - 1
Source/cmOSXBundleGenerator.cxx

@@ -83,7 +83,7 @@ void cmOSXBundleGenerator::CreateFramework(
   std::string newoutpath = outpath + "/" +
     this->GT->GetFrameworkDirectory(this->ConfigName, false);
 
-  std::string frameworkVersion = this->GT->Target->GetFrameworkVersion();
+  std::string frameworkVersion = this->GT->GetFrameworkVersion();
 
   // Configure the Info.plist file into the Resources directory.
   this->MacContentFolders->insert("Resources");

+ 0 - 19
Source/cmTarget.cxx

@@ -2048,25 +2048,6 @@ void cmTarget::SetPropertyDefault(const std::string& property,
     }
 }
 
-//----------------------------------------------------------------------------
-std::string cmTarget::GetFrameworkVersion() const
-{
-  assert(this->GetType() != cmState::INTERFACE_LIBRARY);
-
-  if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
-    {
-    return fversion;
-    }
-  else if(const char* tversion = this->GetProperty("VERSION"))
-    {
-    return tversion;
-    }
-  else
-    {
-    return "A";
-    }
-}
-
 bool cmTarget::GetMappedConfig(std::string const& desired_config,
                                const char** loc,
                                const char** imp,

+ 0 - 4
Source/cmTarget.h

@@ -209,10 +209,6 @@ public:
   /** Return whether this target is an executable Bundle on Apple.  */
   bool IsAppBundleOnApple() const;
 
-  /** Return the framework version string.  Undefined if
-      IsFrameworkOnApple returns false.  */
-  std::string GetFrameworkVersion() const;
-
   /** Get a backtrace from the creation of the target.  */
   cmListFileBacktrace const& GetBacktrace() const;