简体   繁体   English

Xcode如何通过字符串参数传递预处理宏

[英]Xcode How to pass preprocess macros with string argument

I'm using shell script to build the project. 我正在使用Shell脚本来构建项目。 I wanted to pass string (having spaces, eg "Dell Networking") as an argument to GCC_PREPROCESSOR_DEFINITIONS . 我想将字符串(带有空格,例如“ Dell Networking”)作为参数传递给GCC_PREPROCESSOR_DEFINITIONS

I tried following but none of them worked 我尝试了以下操作,但没有一个有效

xcodebuild -verbose -sdk macosx10.7 -project TestProject/TestProject.xcodeproj -configuration Release GCC_PREPROCESSOR_DEFINITIONS="${PreprocessorArg=$TestArgument}"

xcodebuild -verbose -sdk macosx10.7 -project TestProject/TestProject.xcodeproj -configuration Release GCC_PREPROCESSOR_DEFINITIONS=${PreprocessorArg=$TestArgument}

I'm getting only first part of the string(eg Dell) and that is even without double quotes. 我只得到字符串的第一部分(例如Dell),甚至没有双引号。

Try this: 尝试这个:

TestArgument='Dell Networking'
xcodebuild -verbose -sdk macosx10.7 -project TestProject/TestProject.xcodeproj -configuration Release GCC_PREPROCESSOR_DEFINITIONS=${PreprocessorArg="$TestArgument"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM