2013-07-02 11:59:04 +00:00
|
|
|
|
2017-10-15 19:05:08 +00:00
|
|
|
cmake_version_output = $$system(cmake --version 2>$$QMAKE_SYSTEM_NULL_DEVICE, lines)
|
2017-08-16 12:17:38 +00:00
|
|
|
# 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)
|
2013-07-02 11:59:04 +00:00
|
|
|
|
|
|
|
check.commands =
|
2013-07-02 21:07:24 +00:00
|
|
|
QMAKE_EXTRA_TARGETS *= check
|
|
|
|
|
2013-07-02 11:59:04 +00:00
|
|
|
isEmpty(CMAKE_VERSION) {
|
|
|
|
message("cmake executable not found. Not running CMake unit tests")
|
2013-07-02 21:07:24 +00:00
|
|
|
return()
|
|
|
|
}
|
|
|
|
|
2017-09-24 05:26:30 +00:00
|
|
|
CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_SYSTEM_NULL_DEVICE)
|
2013-07-02 21:07:24 +00:00
|
|
|
isEmpty(CTEST_VERSION) {
|
|
|
|
message("ctest executable not found. Not running CMake unit tests")
|
|
|
|
return()
|
2013-07-02 11:59:04 +00:00
|
|
|
}
|
|
|
|
|
2017-09-29 19:45:37 +00:00
|
|
|
!versionAtLeast(CMAKE_VERSION, 3.1.0) {
|
2013-07-02 21:07:24 +00:00
|
|
|
message("cmake $$CMAKE_VERSION is too old for this test.")
|
|
|
|
return()
|
|
|
|
}
|
|
|
|
|
|
|
|
load(cmake_functions)
|
|
|
|
|
|
|
|
CMAKE_BUILD_TYPE = Debug
|
|
|
|
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
2014-03-06 11:28:48 +00:00
|
|
|
win32: CMAKE_GENERATOR = -G \"NMake Makefiles\"
|
2014-01-08 13:12:17 +00:00
|
|
|
mingw:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\"
|
2013-07-02 21:07:24 +00:00
|
|
|
|
|
|
|
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
|
|
|
|
2016-01-18 09:55:49 +00:00
|
|
|
!qtHaveModule(gui): CMAKE_MODULE_DEFINES += -DNO_GUI=True
|
2013-07-02 21:07:24 +00:00
|
|
|
!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
|
2015-04-13 21:33:24 +00:00
|
|
|
|
|
|
|
mod_deps =
|
|
|
|
for (dep, dependentmodules): \
|
|
|
|
!contains(QT.$${dep}.module_config, no_link): \
|
|
|
|
mod_deps += $$cmakeModuleName($$dep)
|
|
|
|
dependentmodules = $$join(mod_deps, ";")
|
2013-07-02 21:07:24 +00:00
|
|
|
|
2016-09-09 07:50:08 +00:00
|
|
|
QT_FOR_CONFIG += gui-private
|
2018-10-19 10:39:12 +00:00
|
|
|
qtHaveModule(gui):qtConfig(angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
|
|
|
|
qtHaveModule(gui):!qtConfig(egl): CMAKE_GL_DEFINES += -DNO_EGL=True
|
2013-07-02 21:07:24 +00:00
|
|
|
|
|
|
|
CMAKE_MODULE_VERSIONS =
|
|
|
|
CMAKE_MODULES_UNDER_TEST =
|
|
|
|
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
|
|
|
|
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
|
2016-12-21 17:52:16 +00:00
|
|
|
ver = $$eval(QT.$${MODULE_UNDER_TEST}.VERSION)
|
2013-07-02 21:07:24 +00:00
|
|
|
CMAKE_MODULE_VERSIONS += \
|
2016-12-21 17:52:16 +00:00
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$section(ver, ., 0, 0) \
|
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$section(ver, ., 1, 1) \
|
|
|
|
-DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$section(ver, ., 2, 2)
|
2013-07-02 21:07:24 +00:00
|
|
|
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
|
|
|
|
}
|
|
|
|
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
|
|
|
|
|
|
|
|
check.commands = \
|
2018-11-28 11:32:00 +00:00
|
|
|
$$sprintf($$QMAKE_MKDIR_CMD, $$BUILD_DIR) $$escape_expand(\\n\\t) \
|
|
|
|
$$QMAKE_CD $$BUILD_DIR && \
|
2013-07-02 21:07:24 +00:00
|
|
|
cmake $$CMAKE_TEST_LOCATION $$CMAKE_GENERATOR \
|
2013-07-19 06:43:53 +00:00
|
|
|
-DCMAKE_C_COMPILER=$$QMAKE_CC \
|
|
|
|
-DCMAKE_CXX_COMPILER=$$QMAKE_CXX \
|
2013-07-02 21:07:24 +00:00
|
|
|
-DCMAKE_VERBOSE_MAKEFILE=1 \
|
|
|
|
$$CMAKE_MODULE_DEFINES \
|
|
|
|
$$CMAKE_GL_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\" && \
|
|
|
|
$(TESTRUNNER) ctest --output-on-failure
|
2013-07-09 09:14:50 +00:00
|
|
|
|
|
|
|
insignificant_test:!isEmpty(check.commands): \
|
|
|
|
check.commands = -$${check.commands}
|