Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake and QT_INSTALL_PREFIX. How can I select a new location for Qt library?

Tags:

build

qt

qmake

I am new to qmake and I am trying to build an existing application. Qt was originally installed in /usr/local/lib/Qt-4.3.5 and 'qmake -query QT_INSTALL_PREFIX' returns that path.

I have moved the Qt library to another location and the generated Makefiles are peppered with the /usr/local original path.

How can I force qmake to use the new location I selected without recompiling Qt?

like image 654
David Segonds Avatar asked May 27 '09 02:05

David Segonds


People also ask

Where is QMake located?

qmake.exe is in bin directory of your Qt installation folder (along with all the Qt dlls for deployment). Your compiler should be detected automatically (check the Tools > Options > Build & Run > Compilers tab).

What is Qmakespec?

QMAKESPEC. qmake requires a platform and compiler description file which contains many default values used to generate appropriate Makefiles. The standard Qt distribution comes with many of these files, located in the mkspecs subdirectory of the Qt installation.


2 Answers

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 (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://doc.qt.io/qt-4.8/qt-conf.html for more details


[Update:] Since at least Qt 5.3.1 (tested with static versions of 5.3.1 and 5.5 on Windows 8) you can simply do

[Paths]
Prefix = ..

and deploy the Qt installation anywhere.

like image 94
Fabio Zadrozny Avatar answered Oct 30 '22 21:10

Fabio Zadrozny


This is a 'builtin' compiled into qmake from qconfig.cpp. The best way is to reconfigure Qt with another -prefix and rebuild unfortunately. For most other variables, you can use a .qmake.cache file. See

http://doc.qt.digia.com/qt/qmake-environment-reference.html

for more info

like image 20
Henrik Hartz Avatar answered Oct 30 '22 21:10

Henrik Hartz