Browse Source

Re-factor framework directory computation.

Nicolas Despres 13 years ago
parent
commit
f8e0a5109f
2 changed files with 17 additions and 12 deletions
  1. 14 12
      Source/cmTarget.cxx
  2. 3 0
      Source/cmTarget.h

+ 14 - 12
Source/cmTarget.cxx

@@ -3688,10 +3688,7 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config,
     dir += "/";
     if(this->IsFrameworkOnApple() && !for_xcode)
       {
-      dir += this->GetFullName(config, false);
-      dir += ".framework/Versions/";
-      dir += this->GetFrameworkVersion();
-      dir += "/";
+      dir += this->GetFrameworkDirectory(config);
       }
     return dir;
     }
@@ -3722,10 +3719,7 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char* config,
 
     if(this->IsFrameworkOnApple() && !for_xcode)
       {
-      dir += this->GetFullName(config, false);
-      dir += ".framework/Versions/";
-      dir += this->GetFrameworkVersion();
-      dir += "/";
+      dir += this->GetFrameworkDirectory(config);
       }
 
     return dir;
@@ -4714,6 +4708,17 @@ std::vector<std::string> cmTarget::GetIncludeDirectories()
   return orderedAndUniqueIncludes;
 }
 
+//----------------------------------------------------------------------------
+std::string cmTarget::GetFrameworkDirectory(const char* config)
+{
+  std::string fpath;
+  fpath += this->GetFullName(config, false);
+  fpath += ".framework/Versions/";
+  fpath += this->GetFrameworkVersion();
+  fpath += "/";
+  return fpath;
+}
+
 //----------------------------------------------------------------------------
 std::string cmTarget::BuildMacContentDirectory(const std::string& base,
                                                const char* config,
@@ -4729,10 +4734,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base,
     }
   if(this->IsFrameworkOnApple())
     {
-    fpath += this->GetFullName(config, false);
-    fpath += ".framework/Versions/";
-    fpath += this->GetFrameworkVersion();
-    fpath += "/";
+    fpath += this->GetFrameworkDirectory(config);
     }
   if(this->IsCFBundleOnApple())
     {

+ 3 - 0
Source/cmTarget.h

@@ -478,6 +478,9 @@ public:
   /** @return whether this target have a well defined output file name. */
   bool HaveWellDefinedOutputFiles();
 
+  /** @return the Mac framework directory without the base. */
+  std::string GetFrameworkDirectory(const char* config = 0);
+
 private:
   /**
    * A list of direct dependencies. Use in conjunction with DependencyMap.