How to integrate static version of Qt additionally to QtCreator
Open QtCreator and go to the Tools / Options menu. Select Qt4:
Add a new version by pressing the plus button enter a name and the path to qmake (Path-To-Qt-SDK\qt_static\bin\qmake.exe) add the MinGW directory (copy from 4.7.0)
If you create a new project, you are asked, which Qt version you want to use. Leave both checkboxes checked.
If you already have a project and want to add this version, go to Projects (left hand of QtCreator) and add a setting.
For the static project configuration, you should add CONFIG+=static in the command line. Open the project settings, and press details for the qmake step. In the additional arguments, add CONFIG+=static
In the project (*.pro) file, add the following:
static { # everything below takes effect with CONFIG ''= static CONFIG+= static CONFIG += staticlib # this is needed if you create a static library, not a static executable DEFINES+= STATIC message("~~~ static build ~~~") # this is for information, that the static build is done mac: TARGET = $$join(TARGET,,,_static) #this adds an _static in the end, so you can seperate static build from non static build win32: TARGET = $$join(TARGET,,,s) #this adds an s in the end, so you can seperate static build from non static build }
What also makes sense is to add a d to the binary, if you create a debug build:
# change the nama of the binary, if it is build in debug mode CONFIG (debug, debug|release) { mac: TARGET = $$join(TARGET,,,_debug) win32: TARGET = $$join(TARGET,,,d) }
Now you have it. Build the static version (select he static project settings and build it).