views:

289

answers:

1

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.

+3  A: 

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.

KennyTM
*when using xcodebuild*
Jaka Jančar
I believe what KennyTM says will work fine in xcodebuild once it's setup (using the GUI).
nall
I was looking at xcodebuild's options/flags, didn't even notice that setting settings was part of the basic usage syntax. Thanks.
Jaka Jančar