Set “OTHER_LDFLAGS” through command line with xcodebuild

China☆狼群 提交于 2019-11-30 16:03:16

I'm not clear what your exact problem is, but hopefully one of these will help you or somebody else:

To override an option you go xcodebuild "OPTIONNAME=newvalue"

xcodebuild "OTHER_LDFLAGS= .... "

Note that this will override any other "OTHER_LDFLAGS" that you might have had in the actual xcode project.

To link a library libNAME.a you need to include in the linker flags -lNAME and also have the location of libNAME.a on the library search path -Lpath/to/my/libraries.

xcodebuild "OTHER_LDFLAGS=-Liphoneos -lTest"

To force the library to link even if there is no dependency (e.g. to include gtest cases) then you need to use -force_load path/to/my/libraries/libNAME.a

xcodebuild "OTHER_LDFLAGS=-force_load iphoneos/libTest.a"

To set OTHER_LDFLAGS from the command-line you would do it like so (note the placement of the quotation marks):

xcodebuild 
  -verbose 
  -configuration Debug build
  archive
  OTHER_LDFLAGS="-ObjC -weak_framework CoreMotion"
  #...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!