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
This commit is contained in:
parent
f551fa6245
commit
7bb9395974
|
@ -56,6 +56,10 @@ if(GLOB_TEMP_VAR)
|
||||||
endif()
|
endif()
|
||||||
set(GLOB_TEMP_VAR)
|
set(GLOB_TEMP_VAR)
|
||||||
|
|
||||||
|
if (Qt_FIND_VERSION)
|
||||||
|
set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# now find qmake
|
# now find qmake
|
||||||
find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
|
find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
|
||||||
if(QT_QMAKE_EXECUTABLE_FINDQT)
|
if(QT_QMAKE_EXECUTABLE_FINDQT)
|
||||||
|
@ -113,15 +117,15 @@ if(QT3_QGLOBAL_H_FILE)
|
||||||
set(QT3_INSTALLED TRUE)
|
set(QT3_INSTALLED TRUE)
|
||||||
endif()
|
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
|
# 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")
|
set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4")
|
||||||
else()
|
else()
|
||||||
# if only one found then pick that one
|
# 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")
|
set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4")
|
||||||
endif()
|
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")
|
set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue