How to find qmake to find QT4

Alexander Neundorf neundorf at
Tue Mar 21 19:08:50 CET 2006

On Tuesday 21 March 2006 14:36, Thiago Macieira wrote:
> Bill Hoffman wrote:
> >In the FindQ4.cmake in CMake, I look for qmake like this:
> >
> >1. CMAKE_PROGRAM_PATH  - environment variable
> >2. CMAKE_PROGRAM_PATH - cmake variable (specified with a -D on the
> > command line) 3. PATH - environment variable
> >4. CMAKE_SYSTEM_PROGRAM_PATH  - this is a per platform set of
> > directories specifed in cmake Platform directory
> >5. A list of common locations:
> > "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir
> >]/bin"
> > "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/b
> >in" $ENV{QTDIR}/bin
> >  ${QT4_PATHS}  # some hard coded places where qt is usually found
> >
> >
> >In the FindQt4.cmake in kdelibs, it looks for qmake by in this order:
> >
> >5.
> >1.
> >2.
> >3.
> >4.
> >
> >The end result is that the qmake in your PATH is not searched first,
> >for example if QTDIR is set, then it will find that one over the one
> >in the PATH.   I thought with QT4 the PATH was supposed to be first.
> >There is a post on the kde-core list talking about this problem.
> The very first one should be the pkg-config check, on Unix platforms. I
> also guess the very first one on Windows should be the registry check.
> $ pkg-config --variable=prefix QtCore
> /home/tjmaciei/troll/qt-4.1-build
> If Qt is not found using pkg-config on Unix platforms, bail out. It is
> supposed to be found anything else is broken.

Ok, then I have two broken systems here, on both I compiled qt-copy and did 
"make install".
Having to mess around with setting up pkgconfig manually in order to be able 
to compile KDE is no option IMO.
I'll add the pkgconfig results as the first location to check.

The reason why I moved QTDIR to the first position is because it is simple.
On my system the Qt3 bin/ dir is in the PATH, while the Qt4 bin/ dir isn't.
Is this broken ?
Currently there no Qt4 apps on my system (except kdelibs), but a lot of Qt3 
software, which is just easier to compile if the Qt3 bin/ dir is in the PATH.

Setting QTDIR to point to the Qt4 installation directory is simple, and 
documented in the wiki (if it would be accessible :-/ )

The other option is to move QTDIR to the lat position and require something 
export PATH=/usr/lib/qt4/bin:$PATH

For me the QTDIR solution just feels better with less potential problems.

Work: alexander.neundorf AT -
Home: neundorf AT                -
      alex AT               -

More information about the Kde-buildsystem mailing list