anyone know if its possible to set cflags/linker flags different for simulator vs device on the same build target in xcode.
In an .xcconfig file, you can have
OTHER_CFLAGS[sdk=iphoneos*] = foobar
OTHER_CFLAGS[sdk=iphonesimulator*] = barfoo
Any build setting can be conditional on a number of things, for example the shortname for an sdk. The device SDKs are named iphoneos-4.0 for example, and sim iphonesimulator-4.0. The above thus gets you the 'foobar' as CFLAG for the device, and 'barfoo' for the sim.
To get started with xcconfigs quickly:
Notice how the build settings UI now lets you edit the conditionals... You can create new conditionals with the lower left button, but it won't let you set "iphoneos*" for example, only specific versions.
Note that the magical $(inherited) lets you make a setting that inherits project settings but overrides just a part of it, like so:
OTHER_CFLAGS[sdk=iphoneos*] = $(inherited) foobar
OTHER_CFLAGS[sdk=iphonesimulator*] = $(inherited) barfoo
I don't know a good resource for xcconfigs, but this'll get you started anyway: http://robnapier.net/blog/build-system-1-build-panel-360#more-360
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With