diff options
author | Brad King <brad.king@kitware.com> | 2015-01-19 14:43:20 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-01-19 14:43:20 (GMT) |
commit | a5be8e3111ff0b6c656facd603c2e2d972d61671 (patch) | |
tree | 75a512c14172c9eb5e157edb2fb9e33323082e21 | |
parent | 953272b725ba98358f262588d89c75bdd3429367 (diff) | |
parent | b937f7537943e56998f1f4630e3684ca7417442b (diff) | |
download | CMake-a5be8e3111ff0b6c656facd603c2e2d972d61671.zip CMake-a5be8e3111ff0b6c656facd603c2e2d972d61671.tar.gz CMake-a5be8e3111ff0b6c656facd603c2e2d972d61671.tar.bz2 |
Merge topic 'FindQt-fixes'
b937f753 FindQt: explicitely mention that it cannot Qt5 or later
6af8cbf2 FindQt: fix variable name in error message
49d05a47 FindQt: fix setting DESIRED_QT_VERSION if "find_package(Qt VVV)" was called
-rw-r--r-- | Modules/FindQt.cmake | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 1bc0940..41b7271 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -13,6 +13,9 @@ # or FindQt4 module is included. Once the user sets DESIRED_QT_VERSION, # then the FindQt3 or FindQt4 module is included. # +# This module can only detect and switch between Qt versions 3 and 4. It +# cannot handle Qt5 or any later versions. +# # :: # # QT_REQUIRED if this is set to TRUE then if CMake can @@ -79,7 +82,11 @@ endif() set(GLOB_TEMP_VAR) if (Qt_FIND_VERSION) - set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}") + if (Qt_FIND_VERSION MATCHES "^([34])(\\.[0-9]+.*)?$") + set(DESIRED_QT_VERSION ${CMAKE_MATCH_1}) + else () + message(FATAL_ERROR "FindQt was called with invalid version '${Qt_FIND_VERSION}'. Only Qt major versions 3 or 4 are supported. If you do not need to support both Qt3 and Qt4 in your source consider calling find_package(Qt3) or find_package(Qt4) instead of find_package(Qt) instead.") + endif () endif () # now find qmake @@ -179,9 +186,9 @@ else() endif() if(NOT QT_FOUND AND DESIRED_QT_VERSION) if(QT_REQUIRED) - message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") + message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_H_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") else() - message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") + message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_H_FILE.") endif() endif() endif() |