As İsmail said there’s no install step for Qt on Windows.
However one can try to approximate it by performing the following operations.
- Cleaning
Runmake clean
in the build folder to remove all temporary files. - Moving
Copy build folder to the place where you want Qt “installed”. Let’s call itINSTALL_DIR
. - Fixing paths hardcoded in the
qmake.exe
executable
Runqmake -query
to see what paths are compiled (hardcoded) into qmake and
a. Fix paths containing the build folder by replacing it with theINSTALL_DIR
usingqmake -set
(1).
or
b. Create aqt.conf
file in the bin subfolder of theINSTALL_DIR
specifing new Qt paths inside it. - Adding current directory to include path
In Qt’s provided binary distributions, the pwd is included in theQMAKE_INCDIR
and thus ends up in your projects include path as “.”. This does not happen by default in a custom built Qt, so you have to add the following line tomkspecs/YOUR-PLATFORM-HERE/qmake.conf
file:
QMAKE_INCDIR += "."
- Fixing
prl
files
When you add a Qt component to a project file (such asCONFIG += uitools
), Qt looks in%QTDIR%/lib/QtUiTools.prl
to find the library dependencies of that component. These files will have the hard coded path of the directory in which Qt was configured and built. You have to replace that build directory with the one to which you moved Qt for alllib/*.prl
files. - Making source available
If you made a shadow build (build made inside folder other than the one containg sources), headers in theinclude
subfolder only forward to the original headers. For example;BUILD_DIR\include\QtCore\qabstractanimation.h
looks like this
#include "SRC_DIR/src/corelib/animation/qabstractanimation.h"
If you don’t want to depend on the existence of the folder containg sources you have to copySRC_DIR/src
subfolder to your destination folder and fix all headers in theinclude
folder so that they forward to the new location ofsrc
subfolder.
The bottom line:
The build process of Qt under Windows makes it really akward to move (install) Qt after building. You should do this only if … well I can’t find any good reason to go through all this trouble.
Remember
The easy way is to place Qt’s sources in the folder where you want Qt to stay after building and make a build in this folder. This makes all steps but 1 and 4 above unnecessary.
1)
The variables you set with qmake -set
are saved in the registry key
HKEY_CURRENT_USER\Software\Trolltech\QMake\<QMAKE_VERSION>
.
Because of this you might have a problem when you would like to have different projects using different versions of Qt which happen to have the same version of qmake. In this case the better solution is to use qt.conf
file (actually files as you need one file for each Qt installation) (option 3b).
Many of the information above come from the RelocationTricks wiki page authored by Gabe Rudy. Check out his Qt (Qt4) Opensource Windows Installers of Pre-built Binaries with MSVC 2008 project which gives you easy solution of above problems.