Linking with a different library in debug and release


#1

I have a Xcode target with two configurations Debug/Release. Pretty usual setup so far.

I'm looking for a way to make Debug link to libmylib_debug.a and Release link with libmylib_release.a. How to do that in the Introjucer? I can only see "External libraries to link" at top (target) level, but not at config level. What is the advised way to do it?

 


#2

You could put the debug/release versions in different folders and have different paths for each config. Or just use a -l directive in the config's extra link flags setting.


#3

I didn't want to change the folder tree of an SDK I don't own, but your proposition gave me an idea.

Each configuration defines a different variable MY_LIB. In debug MY_LIB=/path/to/libmylib_debug.a, in release MY_LIB=/path/to/libmylib_release.a,

and this definition is used at target level in the "Extra linker flags" section.

This seems to work properly. Thanks!