Xcode:如何使用多个 xcconfig 文件设置调试环境? [英] Xcode: How to set debug environment with multiple xcconfig files?

查看:30
本文介绍了Xcode:如何使用多个 xcconfig 文件设置调试环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有 xcconfig 文件的 Xcode 3.2.文件按目标组织.例如,我有一个 debug.xcconfig 文件和一个 release.xcconfig 文件.两者都使用通用设置,因此我添加了一个 shared.xcconfig 文件,该文件包含在两者中.

I'm using Xcode 3.2 with xcconfig files. The files are organized by target. For example, I have a debug.xcconfig file and a release.xcconfig one. Both uses common settings, so I added a shared.xcconfig file which is included by both.

shared.xcconfig 文件如下所示:

GCC_C_LANGUAGE_STANDARD = c99
GCC_WARN_ABOUT_RETURN_TYPE = YES
GCC_WARN_UNUSED_VARIABLE = YES
GCC_PREPROCESSOR_DEFINITIONS = SOME_COMMON_DEFINITIONS

debug.xcconfig 文件如下所示:

#include "Shared.xcconfig"
GCC_OPTIMIZATION_LEVEL = 0

现在,我想在 debug.xcconfig 文件中添加一个 DEBUG 预处理器定义.如这个问题所示,以下方法应该有效:

Now, I would like to add a DEBUG preprocessor definition in the debug.xcconfig file. As shown in this question, the following method is supposed to work:

GCC_PREPROCESSOR_DEFINITIONS = "$(GCC_PREPROCESSOR_DEFINITIONS) DEBUG"

这在 Xcode 3.2 中不起作用.Xcode 文档中也明确提到不能修改变量,只能覆盖.

This doesn't work in Xcode 3.2. The Xcode documentation also explicitly mention that modifying variables is not possible, you can only overwrite them.

你们会如何解决这个问题?

How would you guys solve this problem?

推荐答案

我们过去解决这个问题的方法是让每一层组成定义的一个子集,然后在叶级 xcconfig 将它们组合在一起.

The way we have tackled this in the past is to have each layer compose a subset of the definitions, then bring them all together at the leaf-level xcconfig.

shared.xcconfig 中:

GCC_PREPROCESSOR_DEFINITIONS_SHARED = qFoo qBar qBaz

debug.xcconfig 中:

GCC_PREPROCESSOR_DEFINITIONS_DEBUG = qDebug
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_SHARED) $(GCC_PREPROCESSOR_DEFINITIONS_DEBUG)

(使子集变量变得冗长的优点是它们在字典上与它们用来组合的值相似,使它们更容易在配置文件中找到.)

(The advantage to making the subset variables verbose is that they are lexicographically similar to the value they are used to compose, making them easier to find in the config file.)

这篇关于Xcode:如何使用多个 xcconfig 文件设置调试环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆