MantisBT - CMake
View Issue Details
0014258CMakeCMakepublic2013-06-29 06:122016-05-02 08:30
Andrew S. 
 
highmajoralways
closedfixed 
CMake 2.8.11.1 
CMake 3.5CMake 3.5 
0014258: MACOSX_BUNDLE path problem when building for iOS with Xcode
(Copied from backlogged issue submitted by Duron http://public.kitware.com/Bug/view.php?id=12451 [^]):

I'm not sure if building for iOS is officially supported, but here goes...

When building for iOS with MACOSX_BUNDLE specified on the target, this generates an XCODE_DEPEND_HELPER.make with Foo.app/Contents/MacOS/foo paths in it. However for iOS builds, Xcode places the executable 'foo' in Foo.app/foo.

I couldn't find an option to change this behavior.


The result is that dependency checking does not work and a clean build is required every time the app is compiled.

End of original message

----

This bug is very annoying: you always have to change something each time in a main target to force full project relink when developing a depend library.

See proposed patch below. It introduces MACOSX_BUNDLE_BUILD_FOR_IOS property which will allow to remove "Contents/MacOS" from output paths when building for iOS. The patch is fully working - tried successfully on our big project.
Set up an iOS project by setting CMAKE_OSX_SYSROOT, CMAKE_OSX_ARCHITECTURES and MACOSX_BUNDLE_GUI_IDENTIFIER. Specify MACOSX_BUNDLE for the target executable. Make a change in a dependency and rebuild the app. The app will not be updated.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b14db43..fb3902f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6473,6 +6473,8 @@ std::string cmTarget::GetAppBundleDirectory(const char* config,
                                             bool contentOnly)
 {
   std::string fpath = this->GetFullName(config, false);
+ if (this->GetPropertyAsBool("MACOSX_BUNDLE_BUILD_FOR_IOS"))
+ return fpath + ".app";
   fpath += ".app/Contents";
   if(!contentOnly)
     fpath += "/MacOS";
No tags attached.
has duplicate 0012451closed  MACOSX_BUNDLE path problem when building for iOS with Xcode 
Issue History
2013-06-29 06:12Andrew S.New Issue
2013-07-01 15:43Brad KingAssigned To => Clinton Stimpson
2013-07-01 15:43Brad KingStatusnew => assigned
2013-07-01 15:43Brad KingNote Added: 0033441
2013-07-01 15:44Brad KingRelationship addedhas duplicate 0012451
2013-07-01 15:46Brad KingSummaryMACOSX_BUNDLE path problem when => MACOSX_BUNDLE path problem when building for iOS with Xcode
2013-07-01 15:46Brad KingAdditional Information Updatedbug_revision_view_page.php?rev_id=1205#r1205
2013-07-01 15:56Clinton StimpsonNote Added: 0033443
2013-07-01 15:57Brad KingAssigned ToClinton Stimpson =>
2013-07-01 15:57Brad KingStatusassigned => backlog
2013-07-01 16:01Brad KingNote Added: 0033444
2013-07-01 16:06Clinton StimpsonNote Added: 0033445
2015-12-18 05:18BartoszNote Added: 0039996
2015-12-18 08:17Brad KingNote Added: 0039997
2015-12-18 08:18Brad KingStatusbacklog => resolved
2015-12-18 08:18Brad KingResolutionopen => fixed
2015-12-18 08:18Brad KingFixed in Version => CMake 3.5
2015-12-18 08:18Brad KingTarget Version => CMake 3.5
2016-05-02 08:30Robert MaynardNote Added: 0040989
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0033441)
Brad King   
2013-07-01 15:43   
Clinton, will your post-2.8.11 refactoring resolve this?
(0033443)
Clinton Stimpson   
2013-07-01 15:56   
No, the refactoring doesn't resolve this. It didn't really cover application bundles, let alone various types of application bundles.

If there was another something controlling whether we are building for iOS, I'm wondering why we need another flag, MACOSX_BUNDLE_BUILD_FOR_IOS. I ask because somehow the cmake generated Xcode project was told to create Foo.app/foo instead of Foo.app/Contents/MacOS/foo.

It would help if one attached a sample CMakeLists.txt file with instructions on setting up the project for iOS, or at least pointed to an existing example.
(0033444)
Brad King   
2013-07-01 16:01   
iOS project generation is not fully supported AFAIK.

A possible reason the target is not going where CMake expects it is this change:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c030ef7 [^]

Look at the UsesDefaultOutputDir case.
(0033445)
Clinton Stimpson   
2013-07-01 16:06   
Also related is this:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59a22655 [^]
(0039996)
Bartosz   
2015-12-18 05:18   
This issue was already fixed in CMake 3.5
(0039997)
Brad King   
2015-12-18 08:17   
Re 0014258:0039996: For reference:

 iOS: Fix App Bundle layout
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34f5ef56 [^]
(0040989)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.