浏览代码

BUG: Fix LOCATION property for Mac AppBundles

Previously cmTarget::GetLocation and cmTarget::GetFullPath would return
for Mac AppBundles the top-level bundle directory but without the .app
extension.  We worked around this at the call sites.  This fixes the
methods and removes the work-arounds.  See issue #8406.
Brad King 16 年之前
父节点
当前提交
acb0e8fb85
共有 3 个文件被更改,包括 11 次插入17 次删除
  1. 1 7
      Source/cmExportBuildFileGenerator.cxx
  2. 0 10
      Source/cmGlobalXCodeGenerator.cxx
  3. 10 0
      Source/cmTarget.cxx

+ 1 - 7
Source/cmExportBuildFileGenerator.cxx

@@ -106,16 +106,10 @@ cmExportBuildFileGenerator
   std::string prop = "IMPORTED_LOCATION";
   std::string prop = "IMPORTED_LOCATION";
   prop += suffix;
   prop += suffix;
   std::string value;
   std::string value;
-  if(target->IsFrameworkOnApple())
+  if(target->IsFrameworkOnApple() || target->IsAppBundleOnApple())
     {
     {
     value = target->GetFullPath(config, false);
     value = target->GetFullPath(config, false);
     }
     }
-  else if(target->IsAppBundleOnApple())
-    {
-    value = target->GetFullPath(config, false);
-    value += ".app/Contents/MacOS/";
-    value += target->GetFullName(config, false);
-    }
   else
   else
     {
     {
     value = target->GetFullPath(config, false, true);
     value = target->GetFullPath(config, false, true);

+ 0 - 10
Source/cmGlobalXCodeGenerator.cxx

@@ -2607,11 +2607,6 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
          t->GetType() == cmTarget::MODULE_LIBRARY)
          t->GetType() == cmTarget::MODULE_LIBRARY)
         {
         {
         std::string tfull = t->GetFullPath(configName);
         std::string tfull = t->GetFullPath(configName);
-        if(t->IsAppBundleOnApple())
-          {
-          tfull += ".app/Contents/MacOS/";
-          tfull += t->GetFullName(configName);
-          }
         makefileStream << "\\\n\t" <<
         makefileStream << "\\\n\t" <<
           this->ConvertToRelativeForMake(tfull.c_str());
           this->ConvertToRelativeForMake(tfull.c_str());
         }
         }
@@ -2669,11 +2664,6 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         {
         {
         // Create a rule for this target.
         // Create a rule for this target.
         std::string tfull = t->GetFullPath(configName);
         std::string tfull = t->GetFullPath(configName);
-        if(t->IsAppBundleOnApple())
-          {
-          tfull += ".app/Contents/MacOS/";
-          tfull += t->GetFullName(configName);
-          }
         makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) 
         makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) 
                        << ":";
                        << ":";
 
 

+ 10 - 0
Source/cmTarget.cxx

@@ -1932,6 +1932,11 @@ const char* cmTarget::NormalGetLocation(const char* config)
     this->Location += cfgid;
     this->Location += cfgid;
     this->Location += "/";
     this->Location += "/";
     }
     }
+  if(this->IsAppBundleOnApple())
+    {
+    this->Location += this->GetFullName(config, false);
+    this->Location += ".app/Contents/MacOS/";
+    }
    if(this->IsFrameworkOnApple())
    if(this->IsFrameworkOnApple())
     {
     {
     this->Location += this->GetFullName(config, false);
     this->Location += this->GetFullName(config, false);
@@ -2446,6 +2451,11 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
   std::string fpath = this->GetDirectory(config, implib);
   std::string fpath = this->GetDirectory(config, implib);
   fpath += "/";
   fpath += "/";
 
 
+  if(this->IsAppBundleOnApple())
+    {
+    fpath += this->GetFullName(config, false);
+    fpath += ".app/Contents/MacOS/";
+    }
   if(this->IsFrameworkOnApple())
   if(this->IsFrameworkOnApple())
     {
     {
     fpath += this->GetFullName(config, false);
     fpath += this->GetFullName(config, false);