Projucer Extra Preprocessor Definition with space -> issue


#1

Hi, I’m trying to add this preprocessor definition for an Xcode project, in the Projucer’s Extra Preprocessor Definitions field:

BUILD_NUMBER=`git rev-parse --short HEAD`

This is split by Xcode into multiple definitions due to the spaces inside of it, which can be resolved in Xcode by escaping the spaces:

BUILD_NUMBER=`git\ rev-parse\ --short\ HEAD`

So going back to the Projucer and writing this in the Extra Preprocessor Definitions field, I expected it to get through to the Xcode project config without the split; however for one reason or another the escaping gets lost and the definitions are again split across multiple lines in the Xcode project. Double-escaping yields no better result.


#2

Hi fbecker,

How would you normally go about doing this for an Xcode project without using the Projucer? It seems that multi-word commands are automatically split by Xcode into multiple, separate preprocessor definitions even if you enter them into Xcode directly.

Best,
Ed


#3

Hi Ed,
If you escape the spaces in the Xcode config ("\ "), Xcode doesn’t split the definition.


#4

OK, thanks for the info. Working on a fix now.

Ed


#5

Hi fbecker,

So to add a preprocessor definition with spaces to Xcode via the Projucer’s extra preprocessor definitions field you need to escape the backslash and then escape the space, so you need to use 3 backslashes. So for your command you would need to enter this in the Projucer:

BUILD_NUMBER=`git\\\ rev-parse\\\ --short\\\ HEAD`

which appears in Xcode’s preprocessor definitions as:

BUILD_NUMBER=`git\ rev-parse\ --short\ HEAD`

Hope this helps!
Ed