2 # This is an automatic test for the CMake configuration files.
4 # 1) mkdir build # Create a build directory
6 # 3) cmake .. # Run cmake on this directory.
9 # The expected output is something like:
11 # Start 1: test_use_modules_function
12 # 1/11 Test #1: test_use_modules_function ........ Passed 3.36 sec
13 # Start 2: test_wrap_cpp_and_resources
14 # 2/11 Test #2: test_wrap_cpp_and_resources ...... Passed 1.41 sec
15 # Start 3: test_dependent_modules
16 # 3/11 Test #3: test_dependent_modules ........... Passed 2.22 sec
17 # Start 4: test_add_resource_options
18 # 4/11 Test #4: test_add_resource_options ........ Passed 0.16 sec
19 # Start 5: test_wrap_cpp_options
20 # 5/11 Test #5: test_wrap_cpp_options ............ Passed 0.36 sec
21 # Start 6: test_needsquoting_dirname
22 # 6/11 Test #6: test_needsquoting_dirname ........ Passed 2.20 sec
23 # Start 7: test_platform_defs_include
24 # 7/11 Test #7: test_platform_defs_include ....... Passed 0.28 sec
25 # Start 8: test_qtmainwin_library
26 # 8/11 Test #8: test_qtmainwin_library ........... Passed 1.27 sec
27 # Start 9: test_dbus_module
28 # 9/11 Test #9: test_dbus_module ................. Passed 3.46 sec
29 # Start 10: test_multiple_find_package
30 # 10/11 Test #10: test_multiple_find_package ....... Passed 0.07 sec
31 # Start 11: test_add_resources_delayed_file
32 # 11/11 Test #11: test_add_resources_delayed_file .. Passed 0.38 sec
35 # Note that if Qt is not installed, or if it is installed to a
36 # non-standard prefix, the environment variable CMAKE_PREFIX_PATH
37 # needs to be set to the installation prefix or build prefix of Qt
38 # before running these tests.
40 cmake_minimum_required(VERSION 2.8)
42 project(qmake_cmake_files)
46 find_package(Qt5Core REQUIRED)
48 include("${_Qt5CTestMacros}")
50 if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.9)
51 # Requires INCLUDE_DIRECTORIES target property in CMake 2.8.8
52 # and POSITION_INDEPENDENT_CODE target property in 2.8.9
53 expect_pass(test_use_modules_function)
55 message("CMake version older than 2.8.9 (Found ${CMAKE_VERSION}). Not running test \"test_use_modules_function\"")
57 expect_pass(test_wrap_cpp_and_resources)
58 expect_pass(test_dependent_modules)
59 expect_fail(test_add_resource_options)
60 expect_fail(test_wrap_cpp_options)
61 expect_pass("test(needsquoting)dirname")
62 expect_pass(test_platform_defs_include)
63 expect_pass(test_qtmainwin_library)
65 # If QtDBus has been installed then run the tests for its macros.
66 find_package(Qt5DBus QUIET)
67 if (Qt5DBus_FOUND AND NOT APPLE)
68 expect_pass(test_dbus_module)
70 expect_pass(test_multiple_find_package)
72 # Currently broken on windows. Reported upstream:
73 # http://public.kitware.com/Bug/view.php?id=13392
74 expect_pass(test_add_resources_delayed_file)
76 expect_pass(test_private_includes)
77 expect_pass(test_modules)
78 expect_pass(test_testlib_definitions)
80 expect_fail(test_testlib_no_link_gui)
81 expect_fail(test_testlib_no_link_widgets)
83 execute_process(COMMAND ${CMAKE_COMMAND} -E copy
84 "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
85 "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_gui/test_testlib_no_link_gui/"
87 execute_process(COMMAND ${CMAKE_COMMAND} -E copy
88 "${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
89 "${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"