Functional CMake iOS toolchain file!

NOTE: This toolchain file has been superseded by our own ios-cmake project. Check here for details: http://www.ltengsoft.com/node/21

After almost a solid day of work, we've managed to put together a new CMake toolchain file for iOS 4.3 that builds toadlet for either iOS Devices or any of the iPhone/iPad Simulators, all from the same project.

The real key lies in the altered Platforms/iOS.cmake file that lays out all features of the custom iOS platform. It was built by following the Darwin.cmake platform file provided by CMake. I am sure our new iOS.cmake file isn't perfect, but it gets the job done pretty nicely.

Major differences from our old platform files include:

  • setting CMAKE_OSX_ARCHITECTURES to "$(ARCHS_STANDARD_32_BIT)" allows the combination build option armv6,armv7 in XCode by default
  • -fvisibility=hidden must now be in your CMAKE_CXX_FLAGS
  • iOS Device is the default target in the created XCode project, but you can manually select any of the simulators and they will build properly

Interested in just how we pulled this off? Check out the full toolchain and platform files in the toadlet engine:

Toolchain File: http://code.google.com/p/toadlet/source/browse/cmake/Toolchains/iOS.cmake

Platform File: http://code.google.com/p/toadlet/source/browse/cmake/Modules/Platform/iO...

Happy CMaking!