PDA

View Full Version : How use conditions in Qt .pro file



hubbobubbo
3rd June 2010, 11:17
Hi

I want to do something like this in order to stub out parts of my code when building but I do not know how to achive something similar to ifdef in the Qt pro file:

I would like to do this:

DEFINES += USE_LIBS // I want to build with all my libs

ifdef USE_LIBS
LIBS+= -lmylib1 -lmyLib2
else
//Stub out parts of the app by not including the libs. The USE_LIBS will be 0 and the corresponding includes in the code will be removed with the USE_LIBS define.
endif

Can this conditional building be done in the pro file, if not how can I achive this?

tbscope
3rd June 2010, 11:59
Yes you can do that.
Check out http://doc.qt.nokia.com/4.6/qmake-manual.html

schall_l
26th March 2012, 15:27
Do you have an example ?

wysota
26th March 2012, 17:12
use_libs {
LIBS += -lmylib1 -lmylib2
} else {
# Stub out parts of the app by not including the libs.
}

Then call qmake CONFIG+=use_libs

frankiefrank
14th October 2013, 20:08
Thank you wysota! You helped me to get on the right track!