[CMake] Conditional CFLAG for armv6 only - Xcode, iOS

James Munro james.munro at kwalee.com
Tue Jan 24 07:53:07 EST 2012


Hi there,

I'm using CMake as part of a workflow on various iOS projects. I have a question regarding setting a conditional compiler flag dependent on the architecture being compiled:

Apple LLVM causes a serious bug when compiling for older devices that require the armv6 architecture. The solution is to disable Thumb support for this architecture, but to keep it active for armv7 (using -mno-thumb). A description of the compiler issue is here, for those interested: http://wanderingcoder.net/2010/07/19/ought-arm/ 

I can set this globally in CMake using: set (CMAKE_C_FLAGS "-mno-thumb"). However, I would like to do this only for the armv6 architecture. Setting this up through Xcode is easy using a "conditional build setting", see here for details: http://stackoverflow.com/questions/8390606/is-there-a-way-to-compile-for-arm-rather-than-thumb-in-xcode-4

We use CMake to generate our Xcode projects, and then we work from this projects on a daily basis. However, we treat the projects as temporary scratchpads and often regenerate them from scratch as part of our workflow. Is it possible to mimic this Xcode conditional build setting through my CMake configuration so that we don't need to do it manually through Xcode?

Just in case anyone was wondering, iOS app binaries generally contain both armv6/7 code, so creating a project for one or the other is not an option.

Any help is greatly appreciated.

James Munro, Programmer, Kwalee Ltd
E: james.munro at kwalee.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120124/9b7ef354/attachment.htm>


More information about the CMake mailing list