I am working with unit-test and I managed to create two projects in Qt-Creator: a unit-test project
and Application project
. Compiling both of them separately, I am very happy with both projects.
Then, I managed to link the two projects together, i.e.: testing a class (myClass.cpp
) from my Application project
using the unit-test project
. the link was done by adding:
#INCLUDEPATH myApplicationProjectPath
#SOURCES myApplicationProjectPath/myClass.cpp
to the .pro file
of the unit-test project
and everything is working fine and my unit test is functioning. (I am now building a lib instead of adding paths and classes).
In the meanwhile, in the .pro file
of the Application project
, I am having something like:
#CONFIG(debug, debug|release){
message(Debug bulid)
}
which is a conditional statement to whether compile the code in a Debug or debug|Relase modes.
taking into account that (qmake
processes a pro file
up to three times depending on what the configuration is set to. Usually it will do it three times. Once for debug, once for release and one final one for debug_and_release.), what if I tried to use #CONFIG
in my .pro file
of the Application project
to add a Test mode
. so, when I try to build my project I will have the option to select whether to build in Test, debug or release mode.
doing so will allow me to avoid building separate project for unit-test and just add the classes I need to test within the #SOURCES
section within the Test mode option.
so, is it possible to have four ways of building a code (debug, release, debug|release and Test) ?