From 1dfe15c4314c2b7ef6cb15a5deb274f73c3de3ce Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 3 May 2012 16:46:50 +0200 Subject: [PATCH 1/2] Abort FindQt4.cmake if Qt 5 is found. --- Modules/FindQt4.cmake | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 9b646b443..e7cd02f78 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1169,10 +1169,22 @@ ELSE( Qt4_FIND_COMPONENTS ) ENDIF( Qt4_FIND_COMPONENTS ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 - REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} - VERSION_VAR QTVERSION - ) +if (${QT_VERSION_MAJOR} GREATER 4) + SET(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}") + SET(QT4_FOUND FALSE) + IF(Qt4_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x") + ELSE(Qt4_FIND_REQUIRED) + IF(NOT Qt4_FIND_QUIETLY) + MESSAGE( STATUS "${VERSION_MSG}") + ENDIF(NOT Qt4_FIND_QUIETLY) + ENDIF(Qt4_FIND_REQUIRED) +else() + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 + REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} + VERSION_VAR QTVERSION + ) +endif() ####################################### # From 37a28ffa364b397082aa07cf69b32cf8980e1447 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 May 2012 17:40:04 +0200 Subject: [PATCH 2/2] Fix the number variable comparison when Qt is not found. --- Modules/FindQt4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index e7cd02f78..f9db5e1db 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1169,7 +1169,7 @@ ELSE( Qt4_FIND_COMPONENTS ) ENDIF( Qt4_FIND_COMPONENTS ) -if (${QT_VERSION_MAJOR} GREATER 4) +if (QT_VERSION_MAJOR GREATER 4) SET(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}") SET(QT4_FOUND FALSE) IF(Qt4_FIND_REQUIRED)