Make the qtbase cmake tests work without the Widgets module.

Task-number: QTBUG-28540

Change-Id: I916d104c8aba551ee9a5b34da3fd85dcb26bbf64
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
bb10
Stephen Kelly 2013-03-14 14:08:55 +01:00 committed by The Qt Project
parent 374fc337ae
commit 4111a676f1
4 changed files with 30 additions and 15 deletions

View File

@ -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

View File

@ -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}")

View File

@ -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

View File

@ -35,4 +35,6 @@ endmacro()
add_subdirectory(core_only)
add_subdirectory(gui)
add_subdirectory(widgets)
if(NOT NO_WIDGETS)
add_subdirectory(widgets)
endif()