diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2015-01-16 19:50:15 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2015-01-16 21:06:21 (GMT) |
commit | 49d05a4713729d7531192ae16fc94511dac9b8ec (patch) | |
tree | 0b19691bc377735392414f138c44d4997253d056 | |
parent | 0fcdc57b7b9bbdeaa77c6751b92fd6a14394d1b4 (diff) | |
download | CMake-49d05a4713729d7531192ae16fc94511dac9b8ec.zip CMake-49d05a4713729d7531192ae16fc94511dac9b8ec.tar.gz CMake-49d05a4713729d7531192ae16fc94511dac9b8ec.tar.bz2 |
FindQt: fix setting DESIRED_QT_VERSION if "find_package(Qt VVV)" was called
In case the given version was not only "3" or "4", but something like "4.8"
DESIRED_QT_VERSION was set to an unsupported value. While at it also check
that the version passed in is really in the range of 3.x and 4.x. Also
suggest switching to the more specific find modules if possible.
-rw-r--r-- | Modules/FindQt.cmake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 1bc0940..19f1773 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -79,7 +79,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 |