summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/ctest_testcase_common.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/ctest_testcase_common.prf')
-rw-r--r--mkspecs/features/ctest_testcase_common.prf28
1 files changed, 8 insertions, 20 deletions
diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf
index cdc5cca1d7..f5eafc4e0d 100644
--- a/mkspecs/features/ctest_testcase_common.prf
+++ b/mkspecs/features/ctest_testcase_common.prf
@@ -1,11 +1,15 @@
win32 {
- CMAKE_VERSION = $$system(cmake --version 2>NUL, lines)
+ cmake_version_output = $$system(cmake --version 2>NUL, lines)
} else {
- CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines)
+ cmake_version_output = $$system(cmake --version 2>/dev/null, lines)
}
-CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0)
+# First line
+cmake_version_output = $$first(cmake_version_output)
+# Format is "cmake version X.Y.Z"
+cmake_version_output = $$split(cmake_version_output)
+CMAKE_VERSION = $$last(cmake_version_output)
check.commands =
QMAKE_EXTRA_TARGETS *= check
@@ -26,23 +30,7 @@ isEmpty(CTEST_VERSION) {
return()
}
-CMAKE_VERSION = $$last(CMAKE_VERSION)
-CMAKE_VERSION_MAJOR = $$section(CMAKE_VERSION, ., 0, 0)
-CMAKE_VERSION_MINOR = $$section(CMAKE_VERSION, ., 1, 1)
-CMAKE_VERSION_PATCH = $$section(CMAKE_VERSION, ., 2, 2)
-# CMake can report versions like 2.8.11-rc1, so strip off the rc part.
-CMAKE_VERSION_PATCH ~= s,-.*,,
-
-VERSION_OK =
-greaterThan(CMAKE_VERSION_MAJOR, 2) {
- VERSION_OK = 1
-} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 8) {
- VERSION_OK = 1
-} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 7):greaterThan(CMAKE_VERSION_PATCH, 2) {
- VERSION_OK = 1
-}
-
-isEmpty(VERSION_OK) {
+!versionAtLeast(CMAKE_VERSION, 2.8.3) {
message("cmake $$CMAKE_VERSION is too old for this test.")
return()
}