Here is the case I'm faced with when building my mac app.
The project has three targets: target A is comprised of UI src code and produces the final app; target B produces command-line test program that executes some unit tests(I'm not using the auto generated XXXTests target); and target C is comprised of backend src codes, and produces a static library for target A and target B to link to.
The problem is that target B need target C being built with flag "-DZS_TEST", but target A need target C being built without that flag. So, how to set up xcode project/target settings so that I don't have to change any setting when switching from building target A and target B? Because changing build setting causes git reporting unstaged files, which feels unnecessary because I just want to build a different target.
I'm wondering if xcode can forward flag from depending target to depended target then I can let B forward "-DZS_TEST=1" to C and let target A forward "-DZS_TEST=0" to C.
Or is there better way of dividing the project into different targets?
I googled and found many xcode build setting related articles but they don't share the specific need as this project. So thanks in advance.
I end up using two kernel targets, i.e. target c1, and c2 which use the same source code but different compile flags and c1 build with ZS_TEST defined but c2 not. Then target A and B depend on whichever they need.