Xcode preprocessor macro for configuration?

I want my Xcode Objective-C project to be able to determine which configuration it is being built with. How can I achieve this?

+6
macros c-preprocessor objective-c xcode conditional-compilation
source share
1 answer

You can have macro definitions for each configuration. Open your project settings, select your configuration from the Configuration drop-down menu and go to the Preprocessor Macros . For Debug, I recommend defining the _DEBUG macro, and for release, I recommend defining _RELEASE , since they are typical that are used. They are passed to the compiler as options -D , for example. -D_DEBUG .

You can also put the -D options directly into the Other C flags setting.

+13
source share

All Articles