I have an application called MyApp that is linked to the MyLibrary static library. I added the MyLibrary project to Xcode and added the MyLibrary target to MyApp target dependencies. It all works great, I can set breakpoints, and I'm very happy.
The thing is, I want to have a conditional journal in the library:
#ifdef DEBUG # define MYDebug(msg, ...) NSLog(@"\nDEBUG -> %@ \n(%s:%d)",[NSString stringWithFormat:msg, ## __VA_ARGS__], __PRETTY_FUNCTION__,__LINE__); #else # define MYDebug(msg, ...) #endif
So, I have two build configurations for my library: - Debugging has "DEBUG = 1" in the settings of the target assembly in the "preprocessor macros", - Prod has nothing
And the target of MyLibrary is configured to build with Debug build configuration.
This works fine if I create a static library (.a) and include it in the project. But if it was created using the target dependency, it seems that DEBUG is undefined (MYDebug doesn't write anything).
I also tried setting DEBUG = 1 in the MyApp build settings, but it does not work.
Is there something I missed or another way to do this?
source share