parent
819a4f2e57
commit
abdcf91422
|
@ -372,6 +372,18 @@ IF (QT_QMAKE_EXECUTABLE)
|
||||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
|
STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
|
||||||
STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
|
STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
|
||||||
|
|
||||||
|
# Suppport finding at least a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 )
|
||||||
|
# This implementation is a hack to avoid duplicating code and make sure we stay
|
||||||
|
# source-compatible with CMake 2.6.x
|
||||||
|
# For CMake 2.8, we should not set QT_MIN_VERSION but only use Qt4_FIND_VERSION_MAJOR,
|
||||||
|
# Qt4_FIND_VERSION_MINOR, etc
|
||||||
|
IF( Qt4_FIND_VERSION )
|
||||||
|
SET( QT_MIN_VERSION ${Qt4_FIND_VERSION} )
|
||||||
|
SET( req_qt_major_vers ${Qt4_FIND_VERSION_MAJOR} )
|
||||||
|
SET( req_qt_minor_vers ${Qt4_FIND_VERSION_MINOR} )
|
||||||
|
SET( req_qt_patch_vers ${Qt4_FIND_VERSION_PATCH} )
|
||||||
|
ENDIF( Qt4_FIND_VERSION )
|
||||||
|
|
||||||
IF (NOT req_qt_major_vers EQUAL 4)
|
IF (NOT req_qt_major_vers EQUAL 4)
|
||||||
MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
|
MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
|
||||||
ENDIF (NOT req_qt_major_vers EQUAL 4)
|
ENDIF (NOT req_qt_major_vers EQUAL 4)
|
||||||
|
@ -385,12 +397,27 @@ IF (QT_QMAKE_EXECUTABLE)
|
||||||
MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
|
MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
|
||||||
MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}")
|
MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}")
|
||||||
|
|
||||||
|
# Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT )
|
||||||
|
# The 'else' branch should be removed for CMake 2.8
|
||||||
|
IF( Qt4_FIND_VERSION_EXACT )
|
||||||
|
IF(found_vers EQUAL req_vers)
|
||||||
|
SET( QT4_QMAKE_FOUND TRUE )
|
||||||
|
ELSE(found_vers EQUAL req_vers)
|
||||||
|
SET( QT4_QMAKE_FOUND FALSE )
|
||||||
|
IF (found_vers LESS req_vers)
|
||||||
|
SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
|
||||||
|
ELSE (found_vers LESS req_vers)
|
||||||
|
SET(QT4_INSTALLED_VERSION_TOO_NEW TRUE)
|
||||||
|
ENDIF (found_vers LESS req_vers)
|
||||||
|
ENDIF(found_vers EQUAL req_vers)
|
||||||
|
ELSE( Qt4_FIND_VERSION_EXACT )
|
||||||
IF (found_vers LESS req_vers)
|
IF (found_vers LESS req_vers)
|
||||||
SET(QT4_QMAKE_FOUND FALSE)
|
SET(QT4_QMAKE_FOUND FALSE)
|
||||||
SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
|
SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
|
||||||
ELSE (found_vers LESS req_vers)
|
ELSE (found_vers LESS req_vers)
|
||||||
SET(QT4_QMAKE_FOUND TRUE)
|
SET(QT4_QMAKE_FOUND TRUE)
|
||||||
ENDIF (found_vers LESS req_vers)
|
ENDIF (found_vers LESS req_vers)
|
||||||
|
ENDIF( Qt4_FIND_VERSION_EXACT )
|
||||||
ENDIF (qt_version_tmp)
|
ENDIF (qt_version_tmp)
|
||||||
|
|
||||||
ENDIF (QT_QMAKE_EXECUTABLE)
|
ENDIF (QT_QMAKE_EXECUTABLE)
|
||||||
|
@ -1550,11 +1577,23 @@ IF (QT4_QMAKE_FOUND)
|
||||||
ELSE(QT4_QMAKE_FOUND)
|
ELSE(QT4_QMAKE_FOUND)
|
||||||
|
|
||||||
SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
|
SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
|
||||||
|
|
||||||
|
# The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x
|
||||||
|
# For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and
|
||||||
|
# QT4_INSTALLED_VERSION_TOO_NEW
|
||||||
IF(Qt4_FIND_REQUIRED)
|
IF(Qt4_FIND_REQUIRED)
|
||||||
IF(QT4_INSTALLED_VERSION_TOO_OLD)
|
IF(QT4_INSTALLED_VERSION_TOO_OLD)
|
||||||
MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
|
IF( Qt4_FIND_VERSION_EXACT )
|
||||||
|
MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, version ${QT_MIN_VERSION} is required")
|
||||||
|
ELSE( Qt4_FIND_VERSION_EXACT )
|
||||||
|
MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
|
||||||
|
ENDIF( Qt4_FIND_VERSION_EXACT )
|
||||||
ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
|
ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
|
||||||
MESSAGE( FATAL_ERROR "Qt qmake not found!")
|
IF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
|
||||||
|
MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too new, version ${QT_MIN_VERSION} is required")
|
||||||
|
ELSE( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
|
||||||
|
MESSAGE( FATAL_ERROR "Qt qmake not found!")
|
||||||
|
ENDIF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW )
|
||||||
ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
|
ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
|
||||||
ELSE(Qt4_FIND_REQUIRED)
|
ELSE(Qt4_FIND_REQUIRED)
|
||||||
IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
|
IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
|
||||||
|
|
Loading…
Reference in New Issue