Browse Source

cmGeneratorTarget: Move GetMacContentDirectory from cmTarget.

Stephen Kelly 10 years ago
parent
commit
89e2a080e9

+ 43 - 2
Source/cmGeneratorTarget.cxx

@@ -567,7 +567,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
 
   if(this->Target->IsAppBundleOnApple())
     {
-    std::string macdir = this->Target->BuildMacContentDirectory("", "",
+    std::string macdir = this->BuildMacContentDirectory("", "",
                                                                 false);
     if(!macdir.empty())
       {
@@ -900,6 +900,47 @@ void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
   this->Target->GetFullNameInternal(config, implib, prefix, base, suffix);
 }
 
+//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::BuildMacContentDirectory(const std::string& base,
+                                            const std::string& config,
+                                            bool contentOnly) const
+{
+  std::string fpath = base;
+  if(this->Target->IsAppBundleOnApple())
+    {
+    fpath += this->Target->GetAppBundleDirectory(config, contentOnly);
+    }
+  if(this->Target->IsFrameworkOnApple())
+    {
+    fpath += this->Target->GetFrameworkDirectory(config, contentOnly);
+    }
+  if(this->Target->IsCFBundleOnApple())
+    {
+    fpath += this->Target->GetCFBundleDirectory(config, contentOnly);
+    }
+  return fpath;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
+                                          bool implib) const
+{
+  // Start with the output directory for the target.
+  std::string fpath = this->Target->GetDirectory(config, implib);
+  fpath += "/";
+  bool contentOnly = true;
+  if(this->Target->IsFrameworkOnApple())
+    {
+    // additional files with a framework go into the version specific
+    // directory
+    contentOnly = false;
+    }
+  fpath = this->BuildMacContentDirectory(fpath, config, contentOnly);
+  return fpath;
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
@@ -1527,7 +1568,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
   fpath += "/";
   if(this->Target->IsAppBundleOnApple())
     {
-    fpath = this->Target->BuildMacContentDirectory(fpath, config, false);
+    fpath = this->BuildMacContentDirectory(fpath, config, false);
     fpath += "/";
     }
 

+ 9 - 0
Source/cmGeneratorTarget.h

@@ -123,6 +123,15 @@ public:
                              const std::string& config="",
                              bool implib = false) const;
 
+  /** Append to @a base the mac content directory and return it. */
+  std::string BuildMacContentDirectory(const std::string& base,
+                                       const std::string& config = "",
+                                       bool contentOnly = true) const;
+
+  /** @return the mac content directory for this target. */
+  std::string GetMacContentDirectory(const std::string& config = 0,
+                                     bool implib = false) const;
+
   cmTarget* Target;
   cmMakefile* Makefile;
   cmLocalGenerator* LocalGenerator;

+ 1 - 1
Source/cmOSXBundleGenerator.cxx

@@ -217,7 +217,7 @@ cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc)
   // Construct the full path to the content subdirectory.
 
   std::string macdir =
-    this->GT->Target->GetMacContentDirectory(this->ConfigName,
+    this->GT->GetMacContentDirectory(this->ConfigName,
                                          /*implib*/ false);
   macdir += "/";
   macdir += pkgloc;

+ 0 - 39
Source/cmTarget.cxx

@@ -5400,45 +5400,6 @@ std::string cmTarget::GetAppBundleDirectory(const std::string& config,
   return fpath;
 }
 
-//----------------------------------------------------------------------------
-std::string cmTarget::BuildMacContentDirectory(const std::string& base,
-                                               const std::string& config,
-                                               bool contentOnly) const
-{
-  std::string fpath = base;
-  if(this->IsAppBundleOnApple())
-    {
-    fpath += this->GetAppBundleDirectory(config, contentOnly);
-    }
-  if(this->IsFrameworkOnApple())
-    {
-    fpath += this->GetFrameworkDirectory(config, contentOnly);
-    }
-  if(this->IsCFBundleOnApple())
-    {
-    fpath += this->GetCFBundleDirectory(config, contentOnly);
-    }
-  return fpath;
-}
-
-//----------------------------------------------------------------------------
-std::string cmTarget::GetMacContentDirectory(const std::string& config,
-                                             bool implib) const
-{
-  // Start with the output directory for the target.
-  std::string fpath = this->GetDirectory(config, implib);
-  fpath += "/";
-  bool contentOnly = true;
-  if(this->IsFrameworkOnApple())
-    {
-    // additional files with a framework go into the version specific
-    // directory
-    contentOnly = false;
-    }
-  fpath = this->BuildMacContentDirectory(fpath, config, contentOnly);
-  return fpath;
-}
-
 //----------------------------------------------------------------------------
 cmTargetInternalPointer::cmTargetInternalPointer()
 {

+ 0 - 8
Source/cmTarget.h

@@ -471,10 +471,6 @@ public:
       directory.  */
   bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
 
-  /** @return the mac content directory for this target. */
-  std::string GetMacContentDirectory(const std::string& config,
-                                     bool implib) const;
-
   /** @return whether this target have a well defined output file name. */
   bool HaveWellDefinedOutputFiles() const;
 
@@ -615,10 +611,6 @@ private:
   std::string ImportedGetFullPath(const std::string& config,
                                   bool implib) const;
 
-  /** Append to @a base the mac content directory and return it. */
-  std::string BuildMacContentDirectory(const std::string& base,
-                                       const std::string& config,
-                                       bool contentOnly) const;
 
   void GetSourceFiles(std::vector<std::string> &files,
                       const std::string& config) const;