6db03bbc63
Make sure it doesn't get lost. Task-number: QTBUG-27087 Change-Id: I8b773cfa4b1b9ab5430096c2cff50911e84b73f7 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Toby Tomkins <tjtomkins@gmail.com>
55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
|
|
CMAKE_VERSION = $$system(cmake --version)
|
|
|
|
check.commands =
|
|
isEmpty(CMAKE_VERSION) {
|
|
message("cmake executable not found. Not running CMake unit tests")
|
|
} else {
|
|
CTEST_VERSION = $$system(ctest --version)
|
|
isEmpty(CTEST_VERSION) {
|
|
message("ctest executable not found. Not running CMake unit tests")
|
|
} else {
|
|
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)
|
|
|
|
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) {
|
|
message("cmake $$CMAKE_VERSION is too old for this test.")
|
|
} else {
|
|
CMAKE_BUILD_TYPE = Debug
|
|
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
|
|
|
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
|
|
|
for(d, $$list($$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))) {
|
|
CMAKE_PREFIX_PATH *= $$dirname(d)
|
|
}
|
|
|
|
check.commands = \
|
|
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
|
|
cmake $$_PRO_FILE_PWD_ -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" && \
|
|
$(TESTRUNNER) ctest --output-on-failure
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
# tests fail on Windows - QTBUG-27087
|
|
win32:CONFIG += insignificant_test
|
|
|
|
insignificant_test:!isEmpty(check.commands) {
|
|
check.commands = -$${check.commands}
|
|
}
|
|
|
|
QMAKE_EXTRA_TARGETS *= check
|