The preprocessor transfer determines from the Xcode5 project its contained subprojects

I have an Xcode5 (A) project that depends on another Xcode5 (B) project. Project B is contained as a subproject in project A. Project B needs to pass the definition of the preprocessor from project A, but this seems like an impossible task. By design, preprocessors are not passed from one parent Xcode project to their subprojects. I tried to set the environment variable in the Xcode scheme and select it in project B, but that didn't work either. I have no idea how to do this, although I already spent this morning already ...

Important note: I do not want to change anything in Project B, because the project that will be used by many parent projects, and changes (i.e. preprocessor definitions) should only be done in parent projects, but never in project B.

Edit: A very simple possibility is to have some header file “config.h” with some preprocessor defined in Project A, and Project B will include this file. But without much adding the directory of this file, Project B directories are included in the header, I don’t know how to tell Xcode to find this file (again: I never want to make changes to Project B).

+9
preprocessor xcode xcode5
source share
1 answer

Your request is best served with xcconfig. See this article: https://medium.com/@derrickho_28266/super-preprocessor-directives-with-xcode-8-77bf4d4e5a0c

Alternatively, you can pass definitions completely from the project to the subproject from the command line, for example: xcodebuild -project TopLevelProject.xcodeproj GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS FOOBAR=1'

0
source share

All Articles