Conditional compiling for armv6 and armv7 Conditional compiling for armv6 and armv7 xcode xcode

Conditional compiling for armv6 and armv7


Well i realized my last answer in not the correct one... Apple said that is impossible but this is not really true... thanks to Jim, i search little more and i found one way to do it..

  1. Remove lib from "Build Phases"
  2. Add both architectures in "Other Linker Flags" (Build Settings) , for that you need click in + and add armv6 and armv7
  3. Add the lib in armv7.. with -l
  4. Don't forget #if defined _ARM_ARCH_7 in your code

This is like Jim answered but more detailed.


I received this answer from Apple:

You cannot conditionally build your app for either armv6 or armv7. Your static library must be built for both armv6 and armv7 since your application supports both of these architectures...You can drop support for armv6 by setting your iOS deployment target to 4.3 or higher.

Basically i need to ask the developer of the library to build for both of there architectures ( =/ ) or i set my minimum target to 4.3 and only armv7


In your build settings, if you hover over a setting, a + appears that you can click on to scope a setting to a particular architecture. You'll have to remove the library from the normal list of libraries and add it in by passing the -L argument manually only for armv7. You'll probably also have to add in a preprocessor definition so you can put #ifdefs around the code that calls the library.

Edit: Thinking about it, you might be able to do it in a simpler way by marking the library as optional in the build phases section.