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:
- New file > Other > Configuration Settings File
- Open the project or target editor (cmd-alt-E for the target one)
- Select a setting you want to customize (like cflags), and copy it with cmd-c
- Paste in the new xcconfig file
- Modify as above
- In your project or target editor's lower right corner, select your xcconfig file as "Based On".
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