[Interest] qtchooser and the current importance/interest of QTDIR?

Thiago Macieira thiago.macieira at intel.com
Wed Feb 18 17:16:11 CET 2015


On Wednesday 18 February 2015 13:04:51 René J.V. Bertin wrote:
> On Tuesday February 17 2015 18:27:26 Nikos Chantziaras wrote:
> 
> Hello,
> 
> > QTDIR isn't used anymore. If you want to install to different prefixes,
> > just do so. No QTDIR needed. If you call the right qmake that was
> > installed in the prefix you want, all build paths will be correct for
> > that prefix.
> 
> Bear with me to come back to this :)
> 
> How do the cmake files factor into this, and qtchooser? In other words, how
> does this work for projects that don't expect you to invoke qmake by hand
> (or IDE) but are based on cmake instead? Do Qt5's cmake files have built-in
> support for qtchooser (i.e. they use -qt=qt5), are they rewritten during
> the installation procedure, or does one have to point cmake to the correct
> qmake executable?

qtchooser is a tool that simply wraps the rest of the Qt tools and runs the 
correct one for you, depending on an argument or the environment. Unlike 
QTDIR, the environment variable (QT_SELECT) points to a configuration file, 
allowing for the more flexible installation setups that have been allowed since 
Qt 3.

As for cmake, the answer is simple: they contain hardcoded absolute paths to 
the Qt tools inside the Qt prefix. Those tools are expected to remain where 
they are and not get renamed. They don't need the "-qt5" argument because 
cmake isn't calling qtchooser, it's calling the tool directly.

For example:

/usr/bin/moc -> qtchooser
/usr/lib64/qt5/bin/moc 	actual tool

The cmake file points to the latter and cmake never runs the former.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list