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.8)
51 # Requires INCLUDE_DIRECTORIES target property in CMake 2.8.8
52 expect_pass(test_use_modules_function)
54 message("CMake version older than 2.8.8 (Found ${CMAKE_VERSION}). Not running test \"test_use_modules_function\"")
56 expect_pass(test_wrap_cpp_and_resources)
57 expect_pass(test_dependent_modules)
58 expect_fail(test_add_resource_options)
59 expect_fail(test_wrap_cpp_options)
60 expect_pass("test(needsquoting)dirname")
61 expect_pass(test_platform_defs_include)
62 expect_pass(test_qtmainwin_library)
64 # If QtDBus has been installed then run the tests for its macros.
65 find_package(Qt5DBus QUIET)
66 if (Qt5DBus_FOUND AND NOT APPLE)
67 expect_pass(test_dbus_module)
69 expect_pass(test_multiple_find_package)
70 expect_pass(test_add_resources_delayed_file)
71 expect_pass(test_private_includes)