On Sunday, May 06, 2012 04:27:17 am Benoit Walter wrote: > 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.
What version of cmake are you using? I also have /usr/include/qt4 and a custom Qt, but do not see this problem with the latest cmake. The FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore HINTS ${qt_headers} ${QT_LIBRARY_DIR} PATH_SUFFIXES QtCore qt4/QtCore It should first look for ${qt_headers}/QtCore, which should be /opt/qt4.7/include/QtCore. I tried these 3 ways, but was not able to reproduce. 1. PATH=/path/to/custom/qt/bin:$PATH cmake .. 2. CMAKE_PREFIX_PATH=/path/to/custom/qt cmake .. 3. cmake .. -> modify CMakeCache.txt to use custom qmake then re-run cmake. I have no "/usr/include" in my CMakeCache.txt file. Can you expand the ${qt_headers} and tell me what you have? -- Clinton Stimpson Elemental Technologies, Inc Computational Simulation Software, LLC www.csimsoft.com -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers