2012-06-23 07:48:19 +00:00
|
|
|
|
2012-09-24 10:01:53 +00:00
|
|
|
win32 {
|
|
|
|
CMAKE_VERSION = $$system(cmake --version 2>NUL)
|
|
|
|
} else {
|
|
|
|
CMAKE_VERSION = $$system(cmake --version 2>/dev/null)
|
|
|
|
}
|
|
|
|
|
2012-06-23 07:48:19 +00:00
|
|
|
|
|
|
|
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)
|
2013-03-25 21:26:28 +00:00
|
|
|
# CMake can report versions like 2.8.11-rc1, so strip off the rc part.
|
|
|
|
CMAKE_VERSION_PATCH ~= s,-.*,,
|
2012-06-23 07:48:19 +00:00
|
|
|
|
|
|
|
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 {
|
2013-02-25 10:26:53 +00:00
|
|
|
load(cmake_functions)
|
|
|
|
|
2012-06-23 07:48:19 +00:00
|
|
|
CMAKE_BUILD_TYPE = Debug
|
|
|
|
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
2013-04-15 15:11:07 +00:00
|
|
|
win32-g++*:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\"
|
2013-04-10 13:01:23 +00:00
|
|
|
win32:equals(QT_ARCH, x86_64) {
|
|
|
|
win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\"
|
|
|
|
win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\"
|
|
|
|
}
|
2012-06-23 07:48:19 +00:00
|
|
|
|
|
|
|
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
|
|
|
|
2012-06-29 06:18:56 +00:00
|
|
|
for(d, $$list($$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))) {
|
2012-07-03 07:00:00 +00:00
|
|
|
CMAKE_PREFIX_PATH *= $$dirname(d)
|
2012-06-29 06:18:56 +00:00
|
|
|
}
|
2013-03-12 16:13:48 +00:00
|
|
|
CMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\"
|
2012-06-29 06:18:56 +00:00
|
|
|
|
2013-03-14 13:08:55 +00:00
|
|
|
!qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=True
|
2013-03-14 13:11:47 +00:00
|
|
|
!qtHaveModule(dbus): CMAKE_MODULE_DEFINES += -DNO_DBUS=True
|
2013-03-14 13:08:55 +00:00
|
|
|
|
2013-02-25 10:26:53 +00:00
|
|
|
dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
|
|
|
|
dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
|
|
|
|
dependentmodules = $$cmakeModuleList($$dependentmodules)
|
|
|
|
|
2013-03-27 16:47:40 +00:00
|
|
|
CMAKE_MODULE_VERSIONS =
|
|
|
|
CMAKE_MODULES_UNDER_TEST =
|
|
|
|
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
|
|
|
|
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
|
|
|
|
CMAKE_MODULE_VERSIONS += \
|
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
|
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
|
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
|
|
|
|
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
|
|
|
|
}
|
|
|
|
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
|
|
|
|
|
2012-06-23 07:48:19 +00:00
|
|
|
check.commands = \
|
2013-04-10 10:48:54 +00:00
|
|
|
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
|
2013-03-27 16:47:40 +00:00
|
|
|
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \
|
2013-04-10 10:48:54 +00:00
|
|
|
-DCMAKE_VERBOSE_MAKEFILE=1 \
|
2013-03-27 16:47:40 +00:00
|
|
|
$$CMAKE_MODULE_DEFINES \
|
|
|
|
-DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
|
|
|
|
-DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
|
|
|
|
-DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \
|
|
|
|
$${CMAKE_MODULE_VERSIONS} \
|
|
|
|
-DCMAKE_MODULES_UNDER_TEST=\"$$CMAKE_MODULES_UNDER_TEST\" && \
|
2012-06-23 07:48:19 +00:00
|
|
|
$(TESTRUNNER) ctest --output-on-failure
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
insignificant_test:!isEmpty(check.commands) {
|
|
|
|
check.commands = -$${check.commands}
|
|
|
|
}
|
|
|
|
|
|
|
|
QMAKE_EXTRA_TARGETS *= check
|