[cmake-developers] Regression when using multiple Qt installations (FindQt4.make)

Benoit Walter b.walter at free.fr
Sun May 6 06:27:17 EDT 2012


Hi CMake developers,

as I need to maintain different projects using different Qt versions, I needed 
to have a look at FindQt4.cmake.

Based on the path of qmake, I can successfully decide which Qt version is used 
(for example using Debian's update-alternatives).

Ex:
/opt/qt4.7 (custom version)
/usr/include/qt4 (default version)

However, even if I set qmake to the directory of the custom version, I see 
that cmake uses the headers of the default version.

It seems to me like a regression in commit 
0ae8a3405bb32afadda13f43100484e85f7ef74f ("Add qt4/QtCore to help find Qt 
headers when cross-compiling.")

qt4/QtCore is found in /usr/include instead of /opt/qt4.7/include, in 
contradiction with the qmake information (qmake -query QT_INSTALL_HEADERS).

Corresponding lines in FindQt4.make:
      FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore
                HINTS ${qt_headers} ${QT_LIBRARY_DIR}
                PATH_SUFFIXES QtCore qt4/QtCore
        )

Removing qt4/QtCore fixes the problem, but I guess that the commit was useful 
for other reasons :)
So my suggestion is to either revert the commit because it invalidates a 
common scenario when using cmake with several Qt installations, or to fix the 
FIND_PATH call, making sure that the custom location is found before the 
default one.

Any idea?

Best regards,
Benoit.



More information about the cmake-developers mailing list