Browse Source

Honor BUNDLE_EXTENSION also for App Bundles (#16148)

Gregor Jasny 9 years ago
parent
commit
2b909c08f5

+ 6 - 1
Source/cmGeneratorTarget.cxx

@@ -1350,7 +1350,12 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
                                                      bool contentOnly) const
 {
   std::string fpath = this->GetFullName(config, false);
-  fpath += ".app";
+  fpath += ".";
+  const char* ext = this->GetProperty("BUNDLE_EXTENSION");
+  if (!ext) {
+    ext = "app";
+  }
+  fpath += ext;
   if (!this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Contents";
     if (!contentOnly) {

+ 5 - 0
Source/cmGlobalXCodeGenerator.cxx

@@ -1878,6 +1878,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
 
       // Handle bundles and normal executables separately.
       if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) {
+        const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION");
+        if (ext) {
+          buildSettings->AddAttribute("WRAPPER_EXTENSION",
+                                      this->CreateString(ext));
+        }
         std::string plist = this->ComputeInfoPListLocation(gtgt);
         // Xcode will create the final version of Info.plist at build time,
         // so let it replace the executable name.  This avoids creating

+ 11 - 2
Source/cmInstallTargetGenerator.cxx

@@ -142,13 +142,22 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
       if (this->Target->IsAppBundleOnApple()) {
         cmMakefile const* mf = this->Target->Target->GetMakefile();
 
+        // Get App Bundle Extension
+        const char* ext = this->Target->GetProperty("BUNDLE_EXTENSION");
+        if (!ext) {
+          ext = "app";
+        }
+
         // Install the whole app bundle directory.
         type = cmInstallType_DIRECTORY;
         literal_args += " USE_SOURCE_PERMISSIONS";
-        from1 += ".app";
+        from1 += ".";
+        from1 += ext;
 
         // Tweaks apply to the binary inside the bundle.
-        to1 += ".app/";
+        to1 += ".";
+        to1 += ext;
+        to1 += "/";
         if (!mf->PlatformIsAppleIos()) {
           to1 += "Contents/MacOS/";
         }