I have a bit of a problem with setting different configuration for my project. I have two versions of the same static library. One has logging enabled, the other doesn't.
I am using two different xcconfig files for Debug vs. Release. In these files I specify the library and header search paths for the two variants of the static lib. So far so good.
However, in my build settings I can't see a way to conditionally link the actual library. I.e use the debug variant for Debug and the release for Release.
Any ideas?
You need to link the library using the "Other Linker Flags" build setting, rather than the standard "Link Binary With Libraries" UI. The build setting can be changed depending on the configuration:
Click the triangle and you can give different values for Debug/Release. You will need to use the -l
flag. For example, for a filename of libMyLib.a
use the flag -lMyLib
. You may need to edit the "Library Search Paths" to search the appropriate location.
If the filenames for the debug and release version are the same and you don't want to change them, put them into their own lib/Debug
and lib/Release
directories respectively. Then edit the "Library Search Paths" build setting adding either "$SRCROOT/lib/Debug"
or "$SRCROOT/lib/Release"
for the appropriate configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With