Hello,

On 29/07/15 14:07, Mantis Bug Tracker wrote:
======================================================================
http://www.cmake.org/Bug/view.php?id=15669
======================================================================

this bug caused by different App Bundle layout in MacOSX and iOS. Attached you'll find my proposed patch.

Do you have a better idea to detect the usage of iphone/simulator SDK?
Maybe we should handle this in the platform Darwin modules?

Thanks,
Gregor
>From fdbef203172af5d5603de9383077fbb503661f3f Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gja...@googlemail.com>
Date: Thu, 30 Jul 2015 13:26:10 +0200
Subject: [PATCH] Fix iOS App Bundle layout

In contrast to Mac OS X App bundle layout the iOS one lacks the
Contents/MacOSX structure. See also the Bundle Structures
documentation in Mac Developer Library:

https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html
---
 Source/cmTarget.cxx | 26 +++++++++++++++++++++++---
 Source/cmTarget.h   |  3 +++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cf33791..c39f9c0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -632,6 +632,22 @@ bool cmTarget::IsBundleOnApple() const
 }
 
 //----------------------------------------------------------------------------
+bool cmTarget::IsIosSdkOnApple() const
+{
+  if (!this->IsApple)
+    {
+    return false;
+    }
+
+  std::string sdkRoot;
+  sdkRoot = this->GetMakefile()->GetSafeDefinition("CMAKE_OSX_SYSROOT");
+  sdkRoot = cmSystemTools::LowerCase(sdkRoot);
+
+  return sdkRoot.find("iphoneos") == 0 ||
+         sdkRoot.find("/iphoneos") != std::string::npos;
+}
+
+//----------------------------------------------------------------------------
 static bool processSources(cmTarget const* tgt,
       const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
       std::vector<std::string> &srcs,
@@ -6707,9 +6723,13 @@ std::string cmTarget::GetAppBundleDirectory(const 
std::string& config,
                                             bool contentOnly) const
 {
   std::string fpath = this->GetFullName(config, false);
-  fpath += ".app/Contents";
-  if(!contentOnly)
-    fpath += "/MacOS";
+  fpath += ".app";
+  if(!this->IsIosSdkOnApple())
+    {
+    fpath += "/Contents";
+    if(!contentOnly)
+      fpath += "/MacOS";
+    }
   return fpath;
 }
 
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index f567d50..d383219 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -524,6 +524,9 @@ public:
       or CFBundle on Apple.  */
   bool IsBundleOnApple() const;
 
+  /** Return whether this target uses iOS SDK on Apple */
+  bool IsIosSdkOnApple() const;
+
   /** Return the framework version string.  Undefined if
       IsFrameworkOnApple returns false.  */
   std::string GetFrameworkVersion() const;
-- 
2.4.3

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to