summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/ctest_testcase.prf6
-rw-r--r--src/corelib/Qt5CTestMacros.cmake4
-rw-r--r--tests/auto/cmake/CMakeLists.txt31
-rw-r--r--tests/auto/cmake/test_testlib_definitions/CMakeLists.txt4
4 files changed, 30 insertions, 15 deletions
diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf
index a18c189844..dfbb765a25 100644
--- a/mkspecs/features/ctest_testcase.prf
+++ b/mkspecs/features/ctest_testcase.prf
@@ -44,13 +44,15 @@ isEmpty(CMAKE_VERSION) {
}
CMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\"
+ !qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=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 -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
+ 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
}
@@ -61,6 +63,4 @@ insignificant_test:!isEmpty(check.commands) {
check.commands = -$${check.commands}
}
-!qtHaveModule(widgets): CONFIG += insignificant_test # QTBUG-28540
-
QMAKE_EXTRA_TARGETS *= check
diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake
index 83f407ae12..5d0dc60607 100644
--- a/src/corelib/Qt5CTestMacros.cmake
+++ b/src/corelib/Qt5CTestMacros.cmake
@@ -19,6 +19,10 @@ if (CMAKE_TOOLCHAIN_FILE)
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()
+if (NO_WIDGETS)
+ list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True")
+endif()
+
macro(expect_pass _dir)
string(REPLACE "(" "_" testname "${_dir}")
string(REPLACE ")" "_" testname "${testname}")
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 6da0c9bfa6..4cc0505a8c 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -55,10 +55,12 @@ else()
message("CMake version older than 2.8.9 (Found ${CMAKE_VERSION}). Not running test \"test_use_modules_function\"")
endif()
expect_pass(test_wrap_cpp_and_resources)
-expect_pass(test_dependent_modules)
+if (NOT NO_WIDGETS)
+ expect_pass(test_dependent_modules)
+ expect_pass("test(needsquoting)dirname")
+endif()
expect_fail(test_add_resource_options)
expect_fail(test_wrap_cpp_options)
-expect_pass("test(needsquoting)dirname")
expect_pass(test_platform_defs_include)
expect_pass(test_qtmainwin_library)
@@ -78,29 +80,36 @@ expect_pass(test_testlib_definitions)
expect_pass(test_json_plugin_includes)
expect_fail(test_testlib_no_link_gui)
-expect_fail(test_testlib_no_link_widgets)
-
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_gui/test_testlib_no_link_gui/"
)
-execute_process(COMMAND ${CMAKE_COMMAND} -E copy
- "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
- "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
-)
+
+if (NOT NO_WIDGETS)
+ expect_fail(test_testlib_no_link_widgets)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
+ )
+endif()
set(qt_module_includes
Core QObject
Gui QImage
- Widgets QWidget
Network QHostInfo
- OpenGL QGLBuffer
Sql QSqlError
Test QTestEventList
Xml QDomDocument
- PrintSupport QPrintDialog
)
+if (NOT NO_WIDGETS)
+ list(APPEND qt_module_includes
+ Widgets QWidget
+ OpenGL QGLBuffer
+ PrintSupport QPrintDialog
+ )
+endif()
+
if (UNIX AND NOT APPLE AND NOT QNXNTO)
list(APPEND qt_module_includes
DBus QDBusMessage
diff --git a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
index c370e8effa..cc54bf5bc3 100644
--- a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
+++ b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
@@ -35,4 +35,6 @@ endmacro()
add_subdirectory(core_only)
add_subdirectory(gui)
-add_subdirectory(widgets)
+if(NOT NO_WIDGETS)
+ add_subdirectory(widgets)
+endif()