问题描述
我想知道是否可以在不修改 xcode 项目的情况下更改编译设置.
I would like to know if it is possible to change compile settings without modifying the xcode projects.
示例,将 -Wno-unused-parameter
添加到 CFLAGS
中,以便 Xcode 在构建项目时使用它.
Example, adding -Wno-unused-parameter
to CFLAGS
in such way that it will be used by Xcode when building projects.
这必须在两种情况下都适用:在 GUI 或控制台中使用 xcode 构建.
This has to work in both case: build made from xcode in GUI or from the console.
如果有人问为什么,假设项目数量很大,您可能只想临时更改选项.
If someone asks about why, let's say that the number of projects is quite big and that you may want to alter the options only temporary.
推荐答案
将要更改的编译器设置放在配置设置文件中.您可以通过选择文件">新建">新建文件"来创建一个新文件.配置设置文件在 iOS 和 Mac OS X 下的其他组中.
Put the compiler settings you want to change in a configuration settings file. You can create a new one by choosing File > New > New File. The configuration settings file is in the Other group under both iOS and Mac OS X.
要告诉 Xcode 项目使用配置设置文件,请从项目导航器中选择项目文件以打开项目编辑器.从编辑器的左侧选择项目.单击编辑器顶部的信息按钮.您应该会在编辑器中看到构建配置列表.单击构建配置旁边的显示三角形以使其使用配置设置文件.
To tell an Xcode project to use the configuration settings file, select the project file from the project navigator to open the project editor. Select the project from the left side of the editor. Click the Info button at the top of the editor. You should see a list of build configurations in the editor. Click the disclosure triangle next to a build configuration to have it use a configuration settings file.
这篇关于如何在不修改项目文件的情况下更改 Xcode 构建设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!