bc1fb206bb
Instead of first finding it and then testing that we can find it. Change-Id: I1a1090693520b1d6adadef93839f25d277947e76 Reviewed-by: Alexander Neundorf <neundorf@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
68 lines
2.5 KiB
Plaintext
68 lines
2.5 KiB
Plaintext
|
|
win32 {
|
|
CMAKE_VERSION = $$system(cmake --version 2>NUL)
|
|
} else {
|
|
CMAKE_VERSION = $$system(cmake --version 2>/dev/null)
|
|
}
|
|
|
|
|
|
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 {
|
|
load(cmake_functions)
|
|
|
|
CMAKE_BUILD_TYPE = Debug
|
|
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
|
win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\"
|
|
|
|
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
|
|
|
for(d, $$list($$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))) {
|
|
CMAKE_PREFIX_PATH *= $$dirname(d)
|
|
}
|
|
CMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\"
|
|
|
|
!qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=True
|
|
!qtHaveModule(dbus): CMAKE_MODULE_DEFINES += -DNO_DBUS=True
|
|
|
|
dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
|
|
dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
|
|
dependentmodules = $$cmakeModuleList($$dependentmodules)
|
|
|
|
check.commands = \
|
|
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
|
|
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR $$CMAKE_MODULE_DEFINES -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
|
|
$(TESTRUNNER) ctest --output-on-failure
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
insignificant_test:!isEmpty(check.commands) {
|
|
check.commands = -$${check.commands}
|
|
}
|
|
|
|
QMAKE_EXTRA_TARGETS *= check
|