Xcode 4: Project does not honor $(inherited) Build Setting in Workspace?

痞子三分冷 提交于 2019-12-02 07:37:24

问题


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

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".

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).

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.

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.

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.


回答1:


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


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.



来源:https://stackoverflow.com/questions/13327744/xcode-4-project-does-not-honor-inherited-build-setting-in-workspace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!