From 7bb9395974c2edb078db908cc9c7f1c5752e2aff Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 24 Oct 2012 19:50:47 +0200 Subject: [PATCH 1/2] FindQt: improve version selection -make "find_package(Qt 3)" work -if DESIRED_QT_VERSION was set, but only the other Qt major version was found don't override the DESIRED_QT_VERSION set by the user --- Modules/FindQt.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 13f18fe7a..1a2e16ca5 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -56,6 +56,10 @@ if(GLOB_TEMP_VAR) endif() set(GLOB_TEMP_VAR) +if (Qt_FIND_VERSION) + set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}") +endif () + # now find qmake find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") if(QT_QMAKE_EXECUTABLE_FINDQT) @@ -113,15 +117,15 @@ if(QT3_QGLOBAL_H_FILE) set(QT3_INSTALLED TRUE) endif() -if(QT3_INSTALLED AND QT4_INSTALLED ) +if(QT3_INSTALLED AND QT4_INSTALLED AND NOT DESIRED_QT_VERSION) # force user to pick if we have both set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") else() # if only one found then pick that one - if(QT3_INSTALLED) + if(QT3_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 4) set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() - if(QT4_INSTALLED) + if(QT4_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 3) set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() endif() From 041fb29bd7b25a03ecf5aab2bb6737a10ab21e67 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 24 Oct 2012 19:52:58 +0200 Subject: [PATCH 2/2] FindQt: add some more places to look for Qt3 Qt3 may be e.g. in /usr/lib64/qt-3 or in /usr/lib/qt3, too. --- Modules/FindQt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 1a2e16ca5..5af3125f1 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -31,7 +31,7 @@ # License text for the above reference.) # look for signs of qt3 installations -file(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake) +file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake) if(GLOB_TEMP_VAR) set(QT3_INSTALLED TRUE) endif()