summaryrefslogtreecommitdiffstats
path: root/cmake/QtPlatformSupport.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/QtPlatformSupport.cmake')
-rw-r--r--cmake/QtPlatformSupport.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/QtPlatformSupport.cmake b/cmake/QtPlatformSupport.cmake
index 20feb1cc4a..2468932179 100644
--- a/cmake/QtPlatformSupport.cmake
+++ b/cmake/QtPlatformSupport.cmake
@@ -38,3 +38,42 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(QT_32BIT TRUE)
endif()
+
+# Parses a version string like "xx.yy.zz" and sets the major, minor and patch variables.
+function(qt_parse_version_string version_string out_var_prefix)
+ string(REPLACE "." ";" version_list ${version_string})
+ list(LENGTH version_list length)
+
+ set(out_var "${out_var_prefix}_MAJOR")
+ set(value "")
+ if(length GREATER 0)
+ list(GET version_list 0 value)
+ list(REMOVE_AT version_list 0)
+ endif()
+ set(${out_var} "${value}" PARENT_SCOPE)
+
+ set(out_var "${out_var_prefix}_MINOR")
+ set(value "")
+ if(length GREATER 0)
+ list(GET version_list 0 value)
+ set(${out_var} "${value}" PARENT_SCOPE)
+ list(REMOVE_AT version_list 0)
+ endif()
+ set(${out_var} "${value}" PARENT_SCOPE)
+
+ set(out_var "${out_var_prefix}_PATCH")
+ set(value "")
+ if(length GREATER 0)
+ list(GET version_list 0 value)
+ set(${out_var} "${value}" PARENT_SCOPE)
+ list(REMOVE_AT version_list 0)
+
+ endif()
+ set(${out_var} "${value}" PARENT_SCOPE)
+endfunction()
+
+# Set up the separate version components for the compiler version, to allow mapping of qmake
+# conditions like 'equals(QT_GCC_MAJOR_VERSION,5)'.
+if(CMAKE_CXX_COMPILER_VERSION)
+ qt_parse_version_string("${CMAKE_CXX_COMPILER_VERSION}" "QT_COMPILER_VERSION")
+endif()