13

how can I change Qt install path after I building it ?

Example : qmake.exe search binaries to original install path, how can I change/redefine it ?

Thanks.

Edit : I finally found this patch to apply to Qt :

bernedef
  • 699
  • 2
  • 12
  • 22

6 Answers6

31

I was looking into this and found a way that works (in qt 4.7.2) by customizing qt with a qt.conf file.

In my case, I added a qt4-4.7.2/bin/qt.conf (I think it must be in the same place as the qmake executable)

With the following contents:

[Paths]
Prefix = c:/my_path/to/qt4-4.7.2

and the qmake -query started returning the proper paths!

See: http://qt-project.org/doc/qt-5.0/qtdoc/qt-conf.html for more details

Nightfirecat
  • 11,432
  • 6
  • 35
  • 51
Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
  • Also fixes things for me on Win8 with Qt 4.8.1 – HaMster Jul 08 '15 at 12:07
  • 1
    Not sure if this works for older versions, but in Qt 5.5.0 you can do `Prefix=..`, which allows moving the Qt installation pretty much anywhere. Additionally, when translating e.g. QtCommercialCharts, I had to set the `QMAKEFEATURES` environment variable to `%QTDIR%\mkspecs\features"` so qt_build_config is found. – Tim Meyer Aug 14 '15 at 05:01
  • 1
    I'm using 5.5 and `Prefix=./../` make it work for any path. – zzy Dec 20 '16 at 14:30
  • Works on Windows 10 with Qt 4.8.6. – tony Jun 28 '22 at 09:59
4

You can change path to binaries and many other hardcoded paths in qmake using qmake -set command.
See Configuring qmake's Environment for details.

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
2

I can answer it for windows, not so sure about others. Remove the path variables if any present in the environmental variable PATH.

In Qt-Creator goto,

Tools->Options->Qt4->Qt Versions

In the right hand side area, you will find Auto- Detected and Manual. Under Manual add a new entry by clicking the + symbol in the far right. Specify the QMake location by clicking Browse . Change the Default Qt Version to your newly specified Version. Of course, you have to re -build the application. Hope that it helps.

liaK
  • 11,422
  • 11
  • 48
  • 73
1

On Unix/Linux:

You can also use LD_LIBRARY_PATH+PATH for workarounds. But still, some defaults are hardcoded in the code, yes. A rebuild is a must.

elcuco
  • 8,948
  • 9
  • 47
  • 69
0

On unix you can make a symbolic link, otherwise you probably need to rebuild it

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
0

This worked for me with Qt 5.15.2:

cd ~/Qt/Tools/QtCreator/share/qtcreator/QtProject
grep -inr '<olduser>' | cut -d: -f1 | xargs sed -i 's/<olduser>/<newuser>/g'

Replace <olduser> and <newuser> obviously.

Mat Bess
  • 111
  • 7