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?

Answers


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.


Need Your Help

Order of the lines on makefile

makefile make gnu-make

I have main.cpp (including main function) and func1.cpp, and I want to link these files with a makefile. Classic form would be:

Confused by Symfony's file upload documentation

symfony2 doctrine2

The last section of Symfony 2.1's file upload documentation, which provides instructions on how to use the database id of a document as its filename, rewrites the getAbsolutePath() function: