xcodebuild command line ignoring GCC
I'm trying to launch xcodebuild with different preprocessing macros.
I've tried :
xcodebuild -scheme myscheme
-configuration "Archive"
-sdk "iphoneos5.1"
archive
CONFIGURATION_BUILD_DIR=../build
GCC_PREPROCESSOR_DEFINITIONS=ADHOC
but i got a compilation error due to the fact the preprocessor was not used:
I couldn't 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
The code at the origin of the compilation error is:
#ifdef ADHOC
NSUInteger toto = 0;
#endif
but i get a use of undeclared identifier
error for toto
ps : if i do define Preprocessor Macros in Xcode, then these values are used, mine are overridden, and archiving is done. But I do want to make several builds based on different preprocessor definitions (which sounds a better idea than creating new build configurations or schemes to me)
I have to use double quote and remove the $value. I had,
GCC_PREPROCESSOR_DEFINITIONS='$value ${e}',
which did not work, but
GCC_PREPROCESSOR_DEFINITIONS="${e}"
works.
Where, e is variable inside a 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 like,
GCC_PREPROCESSOR_DEFINITIONS='$value ADHOC=1'
This worked in one of build script.
链接地址: http://www.djcxy.com/p/59788.html下一篇: xcodebuild命令行忽略GCC