[CMake] CMake, iPhone & XCode

bmueller63 at me.com bmueller63 at me.com
Thu Dec 3 09:44:01 EST 2009


Hello,

I am trying to build a project for iPhone using XCode.
The basic stuff works if I use the makefile generator I get my test.app.

Switching wo XCode with -GXcode creates the problem:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CMake Error at /Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):
  The C compiler
  "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2" is not
  able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/sk/Programming/project-template/build/CMakeFiles/CMakeTmp

  Run Build Command:/Applications/CMake\ 2.8-0.app/Contents/bin/cmakexbuild
  -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTryCompileExec
  -configuration Debug

  === BUILD NATIVE TARGET cmTryCompileExec OF PROJECT CMAKE_TRY_COMPILE WITH
  CONFIGURATION Debug ===

  Check dependencies

  target specifies product type 'com.apple.product-type.tool', but there's no
  such product type for the 'iphoneos' platform

  target specifies product type 'com.apple.product-type.tool', but there's no
  such product type for the 'iphoneos' platform

  ** BUILD FAILED **
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The problem is that CMakeTestCCompiler.cmake invokes try_compile. The XCode-Project is build but 
not with add_executable(... MACOSX_BUNDLE ...) which creates a tool instead of an app bundle.
But iPhone only allows app bundles....

I guess the only way to get around this is to create my own version of CMakeTestCCompiler.cmake which
uses try_compile with my own subproject in which the MACOSX_BUNDLE is set.

Or is there a simpler solution?

Can I set the property MACOSX_BUNDLE for all executables to be built?

Greetins
Bernhard M.







More information about the CMake mailing list