Detecting debug/release in QMake

| | Comments (0)

In the qmake makefile have a "config" syntax that allows to set variables based on the existence of a certain config. But, determining if the compilation is "release" or "debug" is not as trivial as it seems.

Direct following the qmake syntax, adding release/debug libraries to the LIBS variables would be written like this:

release:LIBS += -lalpha-MD
debug:LIBS += -lalpha-MDd

This does not work because in some configuration both "release" and "debug" configs are present. To check which one we're really using we must use the following code:

CONFIG( release, release|debug ):LIBS += -lalpha-MD
CONFIG( debug, release|debug ):LIBS += -lalpha-MD

Categories

Leave a comment