I'm trying to automate building process of xcode project. The problem is that I need to add "Other Linker Flags" when building the project. I can't just add it to the project Build Settings manually, I have to do it using the command line. May be I can edit the project file or configuration file somehow? Any options are good as long as it can be runned as a script. Any ideas? Thanks
You can do this by specifying an xcconfig file to xcodebuild. For example:
echo 'OTHER_LDFLAGS = $(OTHER_LDFLAGS) -force_load "$(SRCROOT)/calabash.framework/calabash" -lstdc++' > temp.xcconfig
xcodebuild -xcconfig temp.xcconfig ...
@Jesse Rusak 的答案有效,但直接向命令行添加选项要简单一些,注意从 shell 中转义变量,例如
xcodebuild ... "OTHER_LDFLAGS=\$(OTHER_LDFLAGS) -all_load"
open up the project.pbxproj file in an editor like BBEdit and paste in the flags you want. Search for
buildSettings = {
...
SWIFT_VERSION = 4.2;
}
becomes
buildSetting = {
...
SWIFT_VERSION = 4.2;
OTHER_LDFLAGS = "-all_load";
}
There should be a section for your Debug and Release schemes. Do it for all
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.