Xcodebuild command line ignores GCC_PREPROCESSOR_DEFINITIONS

I am trying to run xcodebuild with various preprocessing macros.

I tried:

xcodebuild -scheme myscheme \ -configuration "Archive" \ -sdk "iphoneos5.1" archive \ CONFIGURATION_BUILD_DIR=../build \ GCC_PREPROCESSOR_DEFINITIONS=ADHOC 

but I got a compilation error because the preprocessor was not used:

I could not see it with the -D flag of the compilation command

But it is displayed at the beginning of the script

 Build settings from command line: CONFIGURATION_BUILD_DIR = ../build GCC_PREPROCESSOR_DEFINITIONS = ADHOC SDKROOT = iphoneos5.1 

Code at the beginning of the compilation error:

 #ifdef ADHOC NSUInteger toto = 0; #endif 

but i get use of undeclared identifier error for toto

ps: if I define preprocessor macros in Xcode, then these values ​​are used, mine are redefined and archiving is done. But I want to make several assemblies based on different preprocessor definitions (which sounds better than creating new assembly configurations or circuits for me)

+7
source share
1 answer

I need to use a double quote and remove the value of $. I have had,

 GCC_PREPROCESSOR_DEFINITIONS='$value ${e}', 

which didn't work but

 GCC_PREPROCESSOR_DEFINITIONS="${e}" 

working.

Where, e is a variable inside the loop,

 environments=("TEST1" "TEST2" "TEST3" "TEST4" "TEST5" "PROD") for e in "${environments[@]}" do ....... commands done 

If i use

 GCC_PREPROCESSOR_DEFINITIONS='$value ${e}' 

Then I have to use for example

 GCC_PREPROCESSOR_DEFINITIONS='$value ADHOC=1' 

This worked in one of the build script.

+2
source

All Articles