Adding a Preprocessor Definition via a Xcode Scheme
I currently have a number of special "flavors" of an iPhone application that I need to build. Ideally, I would like to have a scheme for each "flavor" and each scheme would define (or set) one or more preprocessor definitions that I can use to branch on in my code and possibly even preprocess my info.plist file. This can obviously be done with multiple targets, but since I could have many different "flavors" of the app, it would be great to do it with schemes to keep the target count down. My current thought is to add these preprocessor definitions during a pre-action script, but I can not for the life of me find any way to update GCC_PREPROCESSOR_DEFINITIONS. Since it is an environment variable, shouldn't I have access to append onto GCC_PREPROCESSOR_DEFINITIONS?
Worse case scenario you can do a pre-build script for the scheme. You'll have to include the script for every scheme though:
I would prefer to attach it to a Configuration:
Then you can easily add preprocessor macros for the various configurations, like I have here for Debug:
The <ProjectName>_Prefix.pch file is a great place to put macros that effect the whole program, like I have here:
In my example we're effectively turning off console output when not in debug mode, providing a little speed boost.