tags:

views:

361

answers:

4

I'm using Xcode and .xcconfig files. I'm trying to append some values in the preprocessor definitions, but I simply can't make it work.

I tried the following (as well as many variations of this), but no luck so far:

GCC_PREPROCESSOR_DEFINITIONS = '$(GCC_PREPROCESSOR_DEFINITIONS) NEW_VALUE'

The NEW_VALUE symbol is simply never added to the preprocessor definitions.

Does anyone had success appending new values to variables in xcconfig files?

A: 

This works for me in Xcode 2.4.1:

GCC_PREPROCESSOR_DEFINITIONS = "$(GCC_PREPROCESSOR_DEFINITIONS) NEW_VALUE"

You do have to sometimes allow a few seconds between editing a config file and the change showing up in a target's Build Info.

Charles Anderson
Not much luck with XCode 3.2 :(
Martin Cote
+2  A: 

According to the Xcode Build System Guide:

When a configuration unit contains more than one definition for a particular build setting, Xcode uses the last definition in the unit. Keep in mind that configuration files do not have access to build setting definitions made in configuration files they include. That is, you cannot modify the definition made in an included configuration file; you can only replace it.

So, I guess this mean that it is not possible to append values to a given variable.

Martin Cote
+1  A: 

There is another question with an answer that might help with this particular problem.

fbrereto
+2  A: 

You want to use the placeholder $(inherited) to represent the value inherited from lower levels, e.g.

GCC_PREPROCESSOR_DEFINITIONS = "$(inherited) NEW_VALUE"
cdespinosa