Require CMake 2.8.9 for the qt5_use_modules function.
[profile/ivi/qtbase.git] / tests / auto / cmake / CMakeLists.txt
1
2 # This is an automatic test for the CMake configuration files.
3 # To run it manually,
4 # 1) mkdir build   # Create a build directory
5 # 2) cd build
6 # 3) cmake ..      # Run cmake on this directory.
7 # 4) ctest         # Run ctest
8 #
9 # The expected output is something like:
10 #
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
33 #
34 #
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.
39
40 cmake_minimum_required(VERSION 2.8)
41
42 project(qmake_cmake_files)
43
44 enable_testing()
45
46 find_package(Qt5Core REQUIRED)
47
48 include("${_Qt5CTestMacros}")
49
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)
54 else()
55     message("CMake version older than 2.8.9 (Found ${CMAKE_VERSION}). Not running test \"test_use_modules_function\"")
56 endif()
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)
64
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)
69 endif()
70 expect_pass(test_multiple_find_package)
71 if (NOT WIN32)
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)
75 endif()
76 expect_pass(test_private_includes)
77 expect_pass(test_modules)
78 expect_pass(test_testlib_definitions)
79
80 expect_fail(test_testlib_no_link_gui)
81 expect_fail(test_testlib_no_link_widgets)
82
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/"
86 )
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/"
90 )