I am using Qt Creator and have a Qt GUI project that depends on a C++ static library project. I want to link the release version of the GUI app with the release build of the .lib and the debug release of the GUI app with the debug .lib. I have found out how to add additional libraries to the project by including a line like the following in my .pro file:
LIBS += -L./libfolder -lmylib.lib
But I cannot see how I can use a different -L
command for release and debug builds.
Is there support in qmake to do this?
Best Answer
The normal
solution breaks when users naively use
CONFIG += debug
orCONFIG += release
to switch between debug and release builds (and they do; no-one remembers to sayCONFIG -= release release_and_debug
beforeCONFIG += debug
:).This is the canonical way to scope on
debug
:Cf. the qmake docs.
EDIT 2013-11-17: Don't use
-Lfoo
inLIBS
. The canonical way is to add the paths (without the-L
) toQMAKE_LIBDIR
.