xcodebuild - how to define preprocessor macro?

iphone, xcode, xcodebuild

Solution

Cmd + I on the project to open the Info dialog. Then in the "Build" tab, find the "Preprocessor Macros" setting. Add the macros there.

... Where you can find the setting name is `GCC_PREPROCESSOR_DEFINITIONS`, so you could add

GCC_PREPROCESSOR_DEFINITIONS="foo=bar"

to the xcodebuild arguments.

Problem

How can I define a preprocessor macro when using xcodebuild? I need to build my app using a bunch of different configurations, and I would like to do this using a shell script which runs xcodebuild a number of times with different preprocessor macros.

Original source

Related problems