2011-11-01 13:59:23 +00:00
|
|
|
|
2012-02-15 22:19:19 +00:00
|
|
|
# This is an automatic test for the CMake configuration files.
|
2012-06-22 08:04:05 +00:00
|
|
|
# To run it manually,
|
2012-02-15 22:19:19 +00:00
|
|
|
# 1) mkdir build # Create a build directory
|
|
|
|
# 2) cd build
|
|
|
|
# 3) cmake .. # Run cmake on this directory.
|
|
|
|
# 4) ctest # Run ctest
|
|
|
|
#
|
|
|
|
# The expected output is something like:
|
|
|
|
#
|
2012-06-22 08:04:05 +00:00
|
|
|
# Start 1: test_use_modules_function
|
|
|
|
# 1/11 Test #1: test_use_modules_function ........ Passed 3.36 sec
|
|
|
|
# Start 2: test_wrap_cpp_and_resources
|
|
|
|
# 2/11 Test #2: test_wrap_cpp_and_resources ...... Passed 1.41 sec
|
|
|
|
# Start 3: test_dependent_modules
|
|
|
|
# 3/11 Test #3: test_dependent_modules ........... Passed 2.22 sec
|
|
|
|
# Start 4: test_add_resource_options
|
|
|
|
# 4/11 Test #4: test_add_resource_options ........ Passed 0.16 sec
|
|
|
|
# Start 5: test_wrap_cpp_options
|
|
|
|
# 5/11 Test #5: test_wrap_cpp_options ............ Passed 0.36 sec
|
|
|
|
# Start 6: test_needsquoting_dirname
|
|
|
|
# 6/11 Test #6: test_needsquoting_dirname ........ Passed 2.20 sec
|
|
|
|
# Start 7: test_platform_defs_include
|
|
|
|
# 7/11 Test #7: test_platform_defs_include ....... Passed 0.28 sec
|
|
|
|
# Start 8: test_qtmainwin_library
|
|
|
|
# 8/11 Test #8: test_qtmainwin_library ........... Passed 1.27 sec
|
|
|
|
# Start 9: test_dbus_module
|
|
|
|
# 9/11 Test #9: test_dbus_module ................. Passed 3.46 sec
|
|
|
|
# Start 10: test_multiple_find_package
|
|
|
|
# 10/11 Test #10: test_multiple_find_package ....... Passed 0.07 sec
|
2012-07-20 12:54:50 +00:00
|
|
|
# Start 11: test_add_resources_delayed_file
|
|
|
|
# 11/11 Test #11: test_add_resources_delayed_file .. Passed 0.38 sec
|
2012-06-22 08:04:05 +00:00
|
|
|
#
|
2012-02-15 22:19:19 +00:00
|
|
|
#
|
|
|
|
# Note that if Qt is not installed, or if it is installed to a
|
|
|
|
# non-standard prefix, the environment variable CMAKE_PREFIX_PATH
|
|
|
|
# needs to be set to the installation prefix or build prefix of Qt
|
|
|
|
# before running these tests.
|
|
|
|
|
2011-11-01 13:59:23 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
|
|
|
project(qmake_cmake_files)
|
|
|
|
|
2012-02-15 22:19:19 +00:00
|
|
|
enable_testing()
|
2011-11-01 13:59:23 +00:00
|
|
|
|
2012-06-29 06:32:01 +00:00
|
|
|
find_package(Qt5Core REQUIRED)
|
2011-11-01 13:59:23 +00:00
|
|
|
|
2012-06-29 06:32:01 +00:00
|
|
|
include("${_Qt5CTestMacros}")
|
2011-11-01 13:59:23 +00:00
|
|
|
|
2018-06-14 12:50:39 +00:00
|
|
|
expect_pass(test_use_modules_function)
|
2017-09-29 19:45:37 +00:00
|
|
|
expect_pass(test_umbrella_config)
|
2012-06-22 08:04:05 +00:00
|
|
|
expect_pass(test_wrap_cpp_and_resources)
|
2013-03-14 13:08:55 +00:00
|
|
|
if (NOT NO_WIDGETS)
|
|
|
|
expect_pass(test_dependent_modules)
|
|
|
|
expect_pass("test(needsquoting)dirname")
|
|
|
|
endif()
|
2012-06-22 08:04:05 +00:00
|
|
|
expect_fail(test_add_resource_options)
|
|
|
|
expect_fail(test_wrap_cpp_options)
|
2012-10-15 15:15:41 +00:00
|
|
|
expect_pass(test_platform_defs_include)
|
2012-06-22 08:04:05 +00:00
|
|
|
expect_pass(test_qtmainwin_library)
|
2012-04-23 17:24:13 +00:00
|
|
|
|
2016-02-23 00:13:47 +00:00
|
|
|
if (HAVE_NINJA)
|
|
|
|
make_directory("${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build")
|
|
|
|
add_test(test_QFINDTESTDATA ${CMAKE_CTEST_COMMAND}
|
|
|
|
--build-and-test
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA"
|
|
|
|
# Build in a subdir of the source dir.
|
|
|
|
# This causes Ninja to use relative paths.
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/test_QFINDTESTDATA/build"
|
|
|
|
--build-generator Ninja
|
|
|
|
--build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
|
|
|
|
)
|
|
|
|
add_test(NAME run_test_QFINDTESTDATA COMMAND sh -c "cd \"${CMAKE_SOURCE_DIR}/test_QFINDTESTDATA/build/tests\" && ./test_QFINDTESTDATA -v2")
|
|
|
|
|
|
|
|
set_property(TEST run_test_QFINDTESTDATA
|
|
|
|
PROPERTY DEPENDS test_QFINDTESTDATA
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-03-14 13:11:47 +00:00
|
|
|
if (NOT NO_DBUS)
|
2012-06-22 08:04:05 +00:00
|
|
|
expect_pass(test_dbus_module)
|
2012-04-20 15:40:16 +00:00
|
|
|
endif()
|
2012-06-22 08:04:05 +00:00
|
|
|
expect_pass(test_multiple_find_package)
|
2017-09-29 19:45:37 +00:00
|
|
|
expect_pass(test_add_resources_delayed_file)
|
|
|
|
expect_pass(test_add_binary_resources_delayed_file BINARY test_add_binary_resources_delayed_file)
|
2012-06-22 17:18:45 +00:00
|
|
|
expect_pass(test_private_includes)
|
2016-12-18 23:00:36 +00:00
|
|
|
expect_pass(test_private_targets)
|
2012-07-18 20:25:56 +00:00
|
|
|
expect_pass(test_testlib_definitions)
|
2012-10-02 10:04:00 +00:00
|
|
|
expect_pass(test_json_plugin_includes)
|
2012-07-18 20:25:56 +00:00
|
|
|
|
|
|
|
expect_fail(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_gui/test_testlib_no_link_gui/"
|
|
|
|
)
|
2013-03-14 13:08:55 +00:00
|
|
|
|
|
|
|
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()
|
2012-10-19 14:59:53 +00:00
|
|
|
|
|
|
|
set(qt_module_includes
|
|
|
|
Core QObject
|
|
|
|
Network QHostInfo
|
|
|
|
Sql QSqlError
|
2012-10-29 14:46:26 +00:00
|
|
|
Test QTestEventList
|
2012-10-19 14:59:53 +00:00
|
|
|
Xml QDomDocument
|
|
|
|
)
|
|
|
|
|
2016-03-23 18:26:02 +00:00
|
|
|
if (NOT NO_GUI)
|
|
|
|
list(APPEND qt_module_includes
|
|
|
|
Gui QImage
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-03-14 13:08:55 +00:00
|
|
|
if (NOT NO_WIDGETS)
|
|
|
|
list(APPEND qt_module_includes
|
|
|
|
Widgets QWidget
|
|
|
|
OpenGL QGLBuffer
|
2013-04-24 14:18:37 +00:00
|
|
|
PrintSupport QPrinter
|
2013-03-14 13:08:55 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-03-14 13:11:47 +00:00
|
|
|
if (NOT NO_DBUS)
|
2012-10-19 14:59:53 +00:00
|
|
|
list(APPEND qt_module_includes
|
2012-10-29 14:46:26 +00:00
|
|
|
DBus QDBusMessage
|
2012-10-19 14:59:53 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
test_module_includes(
|
|
|
|
${qt_module_includes}
|
|
|
|
)
|
2012-10-29 14:46:26 +00:00
|
|
|
expect_pass(test_concurrent_module)
|
2013-03-11 15:04:13 +00:00
|
|
|
expect_pass(test_openglextensions_module)
|
2013-05-02 13:25:42 +00:00
|
|
|
if (QT_WITH_ANGLE OR (NOT WIN32 AND NOT APPLE AND NOT NO_EGL))
|
2013-04-22 19:42:52 +00:00
|
|
|
expect_pass(test_egl_lib)
|
2013-04-16 11:38:19 +00:00
|
|
|
endif()
|
2013-04-22 19:42:52 +00:00
|
|
|
expect_pass(test_opengl_lib)
|
2012-11-05 14:18:14 +00:00
|
|
|
|
2017-09-29 19:45:37 +00:00
|
|
|
if (NOT NO_WIDGETS)
|
2012-11-05 14:18:14 +00:00
|
|
|
expect_pass(test_interface)
|
|
|
|
endif()
|
2013-07-08 10:17:35 +00:00
|
|
|
|
2017-09-29 20:17:10 +00:00
|
|
|
expect_pass(test_interface_link_libraries)
|
|
|
|
expect_pass(test_moc_macro_target)
|
2019-05-20 09:37:27 +00:00
|
|
|
|
|
|
|
if (NOT CMAKE_VERSION VERSION_LESS 3.9)
|
|
|
|
# The modification of TARGET_OBJECTS needs the following change in cmake
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/commit/93c89bc75ceee599ba7c08b8fe1ac5104942054f
|
|
|
|
expect_pass(test_add_big_resource)
|
|
|
|
endif()
|
2017-09-29 20:17:10 +00:00
|
|
|
|
|
|
|
if (NOT CMAKE_VERSION VERSION_LESS 3.8)
|
|
|
|
# With earlier CMake versions, this test would simply run moc multiple times and lead to:
|
|
|
|
# /usr/bin/ld: error: CMakeFiles/mywidget.dir/mywidget_automoc.cpp.o: multiple definition of 'MyWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)'
|
|
|
|
# /usr/bin/ld: CMakeFiles/mywidget.dir/moc_mywidget.cpp.o: previous definition here
|
|
|
|
# Reason: SKIP_* properties were added in CMake 3.8 only
|
|
|
|
expect_pass(test_QTBUG-63422)
|
2018-07-09 21:40:15 +00:00
|
|
|
endif()
|