Xcode 4:项目在工作区中不接受$(继承)构建设置吗? [英] Xcode 4: Project does not honor $(inherited) Build Setting in Workspace?

查看:97
本文介绍了Xcode 4:项目在工作区中不接受$(继承)构建设置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天是我受Xcode 4,工作区和项目困扰的日子.

Today is my day to suffer through Xcode 4, Workspaces, and Projects.

我有一个工作区,其中有一个很少的开源库(openssl,sqlcipher和其他几个).在工作区中,有一个主" 项目产生一个EXE作为目标.开源项目是主"项目的子项目"或子项目".它看起来类似于以下内容:

I have a workspace with a few open source libraries (openssl, sqlcipher, and a couple of others). Within the workspace there is one "Main" project which produces an EXE as a target. The open source projects are "subprojects" or "child projects" to the "Main" project. It looks similar to below:

Main Project
  +- OpenSSL Project
  +- SqlCipher Project
  ...

在主"项目的项目"下(而不是目标"下),我设置了预处理程序和警告标志

In the "Main" project, under "Project" (rather than "Target"), I set preprocessor and warning flags build settings. For example, the debug preprocessor macros are "DEBUG=1 SQLITE_DEBUG=1 SQLITE_HAS_CODEC=1" (without the quotes). Conversely, release preprocessor macros is set to "NDEBUG=1 NS_BLOCK_ASSERTIONS=1 SQLITE_HAS_CODEC=1".

在主目标"(不是项目")和所有子项目(项目"和目标")中,确保没有特定于项目的构建设置替代(通过突出显示预处理器宏"并按COMMAND) +删除).然后,我确保将字段设置为"$(继承)"(不带引号).

In the Main "Target" (not "Project") and all subprojects (both "Project" and "Targets"), I ensure there are no project-specific build setting overrides (by highlighting "Preprocessor Macros" and pressing COMMAND+DELETE). I then ensure the field is set to "$(inherited)" (without the quotes).

瞧瞧,子项目不兑现"$(继承)".当我查看Xcode发出的命令行时,GCC_PREPROCESSOR_DEFINITIONS中不存在任何内容.例如,SqlCipher的项目文件不会使用Main继承的生成设置进行编译.

Lo and behold, the child projects do not honor "$(inherited)". When I look at the command line issued by Xcode, nothing is present that should be present from GCC_PREPROCESSOR_DEFINITIONS. For example, the SqlCipher's project files are not compiled with the inherited build settings from Main.

我认为问题可能类似于在XCode的项目设置中忽略了预处理器宏,但在目标设置中没有忽略,但是我似乎无法获得相同的[positive]结果.

I thought the problem might be similar to Preprocessor Macros ignored in XCode's project settings, but not target settings, but I can't seem to get the same [positive] results.

有人可以向我解释如何获得子项目以兑现"$(继承)"吗?在尝试阅读Apple文档时,我只会对阅读的内容和所观察到的行为感到困惑.请像在跟孩子说话一样解释它.

Could anyone explain to me how to get child projects to honor "$(inherited)"? As I try to read through Apple's documentation, I only get more confused by what I read and the behavior I observe. Please explain it as if you were talking to a child.

推荐答案

这些设置不会跨越项目边界.我建议您改为使用.xcconfig文件配置目标(这些文件可能被多个项目引用).

These settings don't cross project boundaries. I recommend you configure your targets using .xcconfig files instead (these may be referenced by multiple projects).

更新/说明::使用您的示例设置:Main Project的构建设置可能会影响Main Project的任何目标,但不会越过OpenSSL Project的目标.

Update/Explanation: Using your example setup: The build settings for Main Project may affect any of Main Project's targets, but they won't cross over to OpenSSL Project's targets.

这篇关于Xcode 4:项目在工作区中不接受$(继承)构建设置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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