[CMake] FindQt4 stubbornly finding Qt3

Zach Laine whatwasthataddress at gmail.com
Tue May 19 10:42:26 EDT 2009


On Tue, May 19, 2009 at 9:11 AM, Andreas Pakulat <apaku at gmx.de> wrote:
> Thats what Clinton did, so how about trying exactly what he wrote?

Ok, removing the two message() lines (which is exactly what Clinton
wrote) produces:

-- Found Qt-Version 4.3.5
-- Configuring done
-- Generating done
-- Build files have been written to: /ldisk/localstorage/proj/cmake/qt_test

I don't see how that helps, since I can't tell what library and
include paths are being detected.

> In particular you could try without the QT_USE_FILE and see wether the
> variables are different then.

Ok, this:

find_package(Qt4)

message(${QT_LIBRARY_DIR}) # prints "/usr/lib"
message(${QT_INCLUDE_DIR}) # prints "/usr/lib/qt3/include"

produces this output:

-- Found Qt-Version 4.3.5
/usr/lib
/usr/lib/qt3/include
-- Configuring done
-- Generating done
-- Build files have been written to: /ldisk/localstorage/proj/cmake/qt_test

> If not the next step would be to start
> putting message() calls into FindQt4.cmake in CMake's Modules/ directory to
> find out why it uses the wrong qmake or wether maybe the qmake supplies the
> wrong paths.

The explicit path to qmake I was using in the original CMakeLists.txt
in my original post was /usr/local/Trolltech/Qt-4.3.5/bin/qmake.
This:

/usr/local/Trolltech/Qt-4.3.5/bin/qmake -v

yields this:

QMake version 2.01a
Using Qt version 4.3.5 in /usr/local/Trolltech/Qt-4.3.5/lib

Another data point -- there was one qmake in my path for all the runs
above, and in all the runs in my previous posts,
/usr/lib/qt3/bin/qmake.  When I removed this qmake, nothing changed.
In fact, now 'which qmake' reports there is no qmake in my path, and
yet FindQt4 still sets the Qt include path to /usr/lib/qt3/include.

As for debugging FindQt4.cmake, surely I'm not the only person ever to
try to use FindQt4 with qt3-devel and qt4-devel, plus another
user-installed Qt version.  If it's finding the wrong qmake, it's
surely my fault for using it wrong, not the FindQt4.cmake file.  I'm
just trying to figure out the script-fu necessary to get it to play
nicely.

Does anyone know what the magic incantation is?

Zach Laine


More information about the CMake mailing list