summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt b/tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt
new file mode 100644
index 0000000000..8278f13a72
--- /dev/null
+++ b/tests/auto/cmake/test_qt_add_ui_7/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(test)
+
+include(../test_qt_add_ui_common/RunCMake.cmake)
+include(../test_qt_add_ui_common/functions.cmake)
+
+get_generators(generators)
+
+foreach(generator IN ITEMS ${generators})
+ message(STATUS "Running tests for generator: ${generator}")
+ is_multi_config(${generator} multi_config_out)
+ # A CI test fails with the below condition. So, we are running the test
+ # only for the Debug configuration.
+ if ("${generator}" MATCHES "Xcode" AND
+ CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ set(configs "Debug")
+ elseif(multi_config_out)
+ set(configs "Debug" "Release")
+ else()
+ set(configs "single_config")
+ endif()
+
+ foreach(config IN ITEMS ${configs})
+ if("${config}" STREQUAL "single_config")
+ set(config_path "")
+ set(config_arg "")
+ else()
+ set(config_path "_${config}")
+ set(config_arg "${config}")
+ endif()
+
+ # Test case 1: There are two widget1.ui files in different folders.
+ # Expect 1: Successful build without the double build issue.
+ # Expect 2: Only touched files to be built.
+ string(CONCAT ui_file "${CMAKE_CURRENT_SOURCE_DIR}/../"
+ "test_qt_add_ui_common/UicIncBuild_sameFileDiffFolder/src/widget1.ui")
+ string(CONCAT test_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/../"
+ "test_qt_add_ui_common/UicIncBuild_sameFileDiffFolder/sub1/sub2/sub3/"
+ "sub4")
+ string(CONCAT test_build_dir "${CMAKE_CURRENT_BINARY_DIR}/"
+ "UicIncBuild_sameFileDiffFolder${config_path}-build")
+ string(CONCAT test_file_to_touch "${CMAKE_CURRENT_SOURCE_DIR}/../"
+ "test_qt_add_ui_common/UicIncBuild_sameFileDiffFolder/src/widget1.ui")
+ generate_hash_folder(
+ "example"
+ "${ui_file}"
+ hash_folder)
+ incremental_build_test(
+ TEST_NAME UicIncBuild_sameFileDiffFolder
+ SOURCE_DIR "${test_source_dir}"
+ BUILD_DIR "${test_build_dir}"
+ CONFIG "${config_arg}"
+ GENERATOR "${generator}"
+ FILE_TO_TOUCH "${test_file_to_touch}"
+ CHECK_UNWANTED_BUILDS
+ )
+
+ endforeach()
+endforeach()