summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Compiler/AppleClang-C.cmake3
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake3
-rw-r--r--Modules/Compiler/Clang-C.cmake3
-rw-r--r--Modules/Compiler/Clang-CXX.cmake3
-rw-r--r--Modules/Compiler/GNU-C-FeatureTests.cmake9
-rw-r--r--Modules/Compiler/GNU-C.cmake14
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake25
-rw-r--r--Modules/Compiler/GNU-CXX.cmake9
-rw-r--r--Modules/FindJsonCpp.cmake117
-rw-r--r--Modules/FindQt.cmake13
10 files changed, 167 insertions, 32 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 0665745..16f420f 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -19,6 +19,7 @@ macro(cmake_record_c_compile_features)
record_compiler_features(C "${std_version}" ${list})
endmacro()
+ set(_result 0)
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
_get_appleclang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
@@ -27,7 +28,5 @@ macro(cmake_record_c_compile_features)
if (_result EQUAL 0)
_get_appleclang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index a508623..978c382 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -26,6 +26,7 @@ macro(cmake_record_cxx_compile_features)
record_compiler_features(CXX "${std_version}" ${list})
endmacro()
+ set(_result 0)
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set(_result 0)
if(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
@@ -37,7 +38,5 @@ macro(cmake_record_cxx_compile_features)
if (_result EQUAL 0)
_get_appleclang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index ebd5c43..548d0a5 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -28,6 +28,7 @@ macro(cmake_record_c_compile_features)
record_compiler_features(C "${std_version}" ${list})
endmacro()
+ set(_result 0)
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
_get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
@@ -36,7 +37,5 @@ macro(cmake_record_c_compile_features)
if (_result EQUAL 0)
_get_clang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 6fe0b56..e07eace 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -38,6 +38,7 @@ macro(cmake_record_cxx_compile_features)
record_compiler_features(CXX "${std_version}" ${list})
endmacro()
+ set(_result 0)
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
_get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
if (_result EQUAL 0)
@@ -46,7 +47,5 @@ macro(cmake_record_cxx_compile_features)
if (_result EQUAL 0)
_get_clang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake
index dfaeebf..7e840aa 100644
--- a/Modules/Compiler/GNU-C-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-C-FeatureTests.cmake
@@ -1,7 +1,12 @@
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
-set(GNU46_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
+# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
+# to 201000L. As the former is strictly greater than the latter, test only
+# for the latter. If in the future CMake learns about a C feature which was
+# introduced with GNU 4.7, that should test for the correct version, similar
+# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
+set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
# Since 4.4 at least:
set(GNU44_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index db9089d..d5e747d 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,20 +1,25 @@
include(Compiler/GNU)
__compiler_gnu(C)
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+endif()
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set(CMAKE_C_STANDARD_DEFAULT 11)
-else(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+else()
set(CMAKE_C_STANDARD_DEFAULT 90)
endif()
@@ -23,7 +28,8 @@ macro(cmake_record_c_compile_features)
record_compiler_features(C "${std_version}" ${list})
endmacro()
- if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+ set(_result 0)
+ if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
_get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
@@ -31,7 +37,5 @@ macro(cmake_record_c_compile_features)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
index 6de06dd..267d658 100644
--- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -2,7 +2,7 @@
# Reference: http://gcc.gnu.org/projects/cxx0x.html
# http://gcc.gnu.org/projects/cxx1y.html
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
@@ -46,7 +46,6 @@ set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
-set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
@@ -55,22 +54,28 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
# support -std=c++11. Prior to that, support for C++11 features is technically
# experiemental and possibly incomplete (see for example the note below about
# cxx_variadic_template_template_parameters)
+# GNU does not define __cplusplus correctly before version 4.7.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
+# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be
+# defined in the future.
+set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
# TODO: Should be supported by GNU 4.6
-set(GNU46_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
# TODO: Should be supported by GNU 4.5
-set(GNU45_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(GNU45_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}")
set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
# TODO: Should be supported by GNU 4.4
-set(GNU44_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(GNU44_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
@@ -90,7 +95,7 @@ set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}")
# templates capability in CMake. See
# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
# TODO: Should be supported by GNU 4.3
-set(GNU43_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(GNU43_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}")
set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}")
set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}")
@@ -98,8 +103,8 @@ set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}")
set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}")
set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}")
# TODO: Should be supported since GNU 3.4?
-set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
# TODO: Should be supported forever?
-set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && __cplusplus >= 201103L")
-set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && __cplusplus >= 201103L")
-set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus >= 199711L")
+set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 4a26963..eeada86 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -11,7 +11,7 @@ else()
endif()
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
# Supported since 4.3
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
@@ -20,7 +20,10 @@ endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
# 4.3 supports 0x variants
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
@@ -42,14 +45,12 @@ macro(cmake_record_cxx_compile_features)
if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
_get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
endif()
- if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
endif()
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
endif()
- else()
- set(_result 0)
endif()
endmacro()
diff --git a/Modules/FindJsonCpp.cmake b/Modules/FindJsonCpp.cmake
new file mode 100644
index 0000000..cbb4fb3
--- /dev/null
+++ b/Modules/FindJsonCpp.cmake
@@ -0,0 +1,117 @@
+#[=======================================================================[.rst:
+FindJsonCpp
+-----------
+
+Find JsonCpp includes and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+An :ref:`imported target <Imported targets>` named
+``JsonCpp::JsonCpp`` is provided if JsonCpp has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``JsonCpp_FOUND``
+ True if JsonCpp was found, false otherwise.
+``JsonCpp_INCLUDE_DIRS``
+ Include directories needed to include JsonCpp headers.
+``JsonCpp_LIBRARIES``
+ Libraries needed to link to JsonCpp.
+``JsonCpp_VERSION_STRING``
+ The version of JsonCpp found.
+ May not be set for JsonCpp versions prior to 1.0.
+``JsonCpp_VERSION_MAJOR``
+ The major version of JsonCpp.
+``JsonCpp_VERSION_MINOR``
+ The minor version of JsonCpp.
+``JsonCpp_VERSION_PATCH``
+ The patch version of JsonCpp.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+This module uses the following cache variables:
+
+``JsonCpp_LIBRARY``
+ The location of the JsonCpp library file.
+``JsonCpp_INCLUDE_DIR``
+ The location of the JsonCpp include directory containing ``json/json.h``.
+
+The cache variables should not be used by project code.
+They may be set by end users to point at JsonCpp components.
+#]=======================================================================]
+
+#=============================================================================
+# Copyright 2014-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+#-----------------------------------------------------------------------------
+find_library(JsonCpp_LIBRARY
+ NAMES jsoncpp
+ )
+mark_as_advanced(JsonCpp_LIBRARY)
+
+find_path(JsonCpp_INCLUDE_DIR
+ NAMES json/json.h
+ PATH_SUFFIXES jsoncpp
+ )
+mark_as_advanced(JsonCpp_INCLUDE_DIR)
+
+#-----------------------------------------------------------------------------
+# Extract version number if possible.
+set(_JsonCpp_H_REGEX "^#[ \t]*define[ \t]+JSONCPP_VERSION_STRING[ \t]+\"(([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*)\".*$")
+if(JsonCpp_INCLUDE_DIR AND EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h")
+ file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_H REGEX "${_JsonCpp_H_REGEX}")
+else()
+ set(_JsonCpp_H "")
+endif()
+if(_JsonCpp_H MATCHES "${_JsonCpp_H_REGEX}")
+ set(JsonCpp_VERSION_STRING "${CMAKE_MATCH_1}")
+ set(JsonCpp_VERSION_MAJOR "${CMAKE_MATCH_2}")
+ set(JsonCpp_VERSION_MINOR "${CMAKE_MATCH_3}")
+ set(JsonCpp_VERSION_PATCH "${CMAKE_MATCH_4}")
+else()
+ set(JsonCpp_VERSION_STRING "")
+ set(JsonCpp_VERSION_MAJOR "")
+ set(JsonCpp_VERSION_MINOR "")
+ set(JsonCpp_VERSION_PATCH "")
+endif()
+unset(_JsonCpp_H_REGEX)
+unset(_JsonCpp_H)
+
+#-----------------------------------------------------------------------------
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JsonCpp
+ FOUND_VAR JsonCpp_FOUND
+ REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
+ VERSION_VAR JsonCpp_VERSION_STRING
+ )
+set(JSONCPP_FOUND ${JsonCpp_FOUND})
+
+#-----------------------------------------------------------------------------
+# Provide documented result variables and targets.
+if(JsonCpp_FOUND)
+ set(JsonCpp_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR})
+ set(JsonCpp_LIBRARIES ${JsonCpp_LIBRARY})
+ if(NOT TARGET JsonCpp::JsonCpp)
+ add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED)
+ set_target_properties(JsonCpp::JsonCpp PROPERTIES
+ IMPORTED_LOCATION "${JsonCpp_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ )
+ endif()
+endif()
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()