Debian Codegraph @

tests/auto/cmake/test_qt_add_ui_9/CMakeLists.txt

raw
1 # Copyright (C) 2024 The Qt Company Ltd.
2 # SPDX-License-Identifier: BSD-3-Clause
3
4 cmake_minimum_required(VERSION 3.16)
5 project(test)
6
7 include(../test_qt_add_ui_common/RunCMake.cmake)
8 include(../test_qt_add_ui_common/functions.cmake)
9
10 get_generators(generators)
11
12 foreach(generator IN ITEMS ${generators})
13 message(STATUS "Running tests for generator: ${generator}")
14 is_multi_config(${generator} multi_config_out)
15 if(multi_config_out)
16 # Since our CI machines are slow, ctest --build-and-test buffers the
17 # output of the configure step of a test, and the fact that we run all
18 # the test logic in the configure step, we need to exclude Release
19 # to avoid CI stdout timeout errors.
20 # See https://gitlab.kitware.com/cmake/cmake/-/issues/25790
21 set(configs "Debug" "Release")
22 else()
23 set(configs "single_config")
24 endif()
25
26 foreach(config IN ITEMS ${configs})
27 if("${config}" STREQUAL "single_config")
28 set(config_path "")
29 set(config_arg "")
30 else()
31 set(config_path "_${config}")
32 set(config_arg "${config}")
33 endif()
34
35 # Test case: ui_mainwindow.h is included as
36 # "sub2/sub3/../../../src/ui_files/ui_mainwindow.h".
37 # Expect 1: Successful build without the double build issue.
38 # Expect 2: No build folder leakage and generation of
39 # _/sub2/sub3 in ${hash_folder}/include.
40 # Note: This test case is a mix of previous two test cases.
41 string(CONCAT test_ui_file "${CMAKE_CURRENT_SOURCE_DIR}/../"
42 "test_qt_add_ui_common/uic_test/mainwindow.ui")
43 generate_hash_folder("example" "${test_ui_file}" hash_folder)
44 set(test_build_dir
45 "${CMAKE_CURRENT_BINARY_DIR}/UicBuildLeak_mix${config_path}-build")
46 string(CONCAT test_additional_args "-DMAINWINDOW_UI_PATH=sub2/sub3/"
47 "../../../src/ui_files/")
48 string(CONCAT test_file_to_check "${test_build_dir}/.qt/${hash_folder}/"
49 "${config_arg}/src/ui_files/ui_mainwindow.h")
50 string(CONCAT test_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/../"
51 "test_qt_add_ui_common/uic_test")
52 incremental_build_test(
53 TEST_NAME UicBuildLeak_mix
54 SOURCE_DIR "${test_source_dir}"
55 BUILD_DIR "${test_build_dir}"
56 CONFIG "${config_arg}"
57 GENERATOR "${generator}"
58 ADDITIONAL_ARGS "${test_additional_args}"
59 FILE_TO_TOUCH "${test_ui_file}"
60 FILE_TO_CHECK "${test_file_to_check}"
61 FOLDER_TO_CHECK
62 "${test_build_dir}/.qt/${hash_folder}/${config_arg}/_/sub2/sub3"
63 )
64 endforeach()
65 endforeach()
66