Xcode environment variables for sub projects Xcode environment variables for sub projects xcode xcode

Xcode environment variables for sub projects


you accomplish this without multiple definitions by creating xcconfig files and then referencing or #include-ing them throughout your projects. so, you could apply Mattias' suggestion and then define the preprocessor defs in the xcconfig. then you have one file to change (and a full rebuild if you require these defs in the pch file, which there are separate settings for).

xcode also lets you assign separate xcconfigs per build configuration.


I would edit the schema and add a pre-build shell script to set the proper variables.When you add a script you can establish from which target you are getting the definitions.


Maybe add a define using the "Preprocessor macros" build setting to the targets and or debug/release build configurations where you want to enable debug.

In your case you would double click on on the value column and then click "+" to add a new macro. The marco would be "FOOMODULE_DEBUG_LEVEL=1" which should result in -DFOOMODULE_DEBUG_LEVEL=1 to the compiler.