[cmake-developers] iOS support

Bill Hoffman bill.hoffman at kitware.com
Tue Sep 23 10:06:11 EDT 2014


On 9/23/2014 8:09 AM, Robert Maynard wrote:
> The lowest hanging fruit would be to transition over to setting the
> global variable CMAKE_MACOSX_BUNDLE which is used to initialize the
> MACOSX_BUNDLE property on all the targets. CMake also supports
> CMAKE_XCODE_ATTRIBUTE global variables to allow easy code signing etc.
>
> Lastly have you looked at setting up different toolchains for the
> simulator and device?
We have recently looked at this problem.   Setting CMAKE_MACOSX_BUNDLE 
in the toolchain file gets you part of the way there.  However, some 
try_compile stuff will still fail because it can not find the app bundles.


cmake_minimum_required(VERSION 2.8)
project(foo)
include(TestBigEndian)
test_big_endian(CMAKE_WORDS_BIGENDIAN)


https://github.com/Kitware/VTK/blob/master/CMake/ios.toolchain.xcode.cmake
This will get you to the problem:

cmake -GXcode -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.xcode.cmake .. 
-DIOS_PLATFORM=SIMULATOR


Trouble is in cmake/Modules/CheckTypeSize.cmake where it does a 
try_compile with COPY_FILE.  The COPY_FILE in cmCoreTryCompile.cxx does 
not look for the bundle option and therefore can not find the executable.

However, now that I look at it, I think I might be able to fix it pretty 
easy.

That said it would be really cool to beef up the xcode support enough to 
be able to create an actual ios app.  I have not dug into that enough. 
Should be able to do most of it with CMAKE_XCODE_ATTRIBUTE.     I will 
look into this try_compile COPY_FILE issue today and get back to the list.

It would be great if you could get an example/Test in place that builds 
an app for a device and works with Xcode and for a stretch goal also 
works with makefiles or ninja.

-Bill








More information about the cmake-developers mailing list