Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top