Important: Please read the Qt Code of Conduct -

How to conditionally add build settings?

  • Hi,

    I've tried to find solution on a forum but couldn't. I would like to add some build settings depending if I am building my program in debug or release mode, how to do that? For example:

    I have this setting:

    win32: LIBS += -L$$PWD/../../C++/Libs/MyLibrary/x64/ -lMyLibrary_x64_v141_Debug

    So I am statically linking a .lib which is in debug mode. How to link against different version of this library if I am building in release mode?

    Another case, I have a conditional define which I would like to only use in Debug build:


    Thanks for your help.

  • Lifetime Qt Champion

    Something like

    CONFIG(debug, debug|release) {
    } else {

  • Thank you:)

Log in to reply