From 360293623094a31586981206e59c92aa6235163d Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Thu, 9 Mar 2023 14:53:14 +0100 Subject: Improve the internal handling of unity build - Removed the NO_UNITY_BUILD argument from commands that disable it by default. - Add a warning in case NO_UNITY_BUILD or NO_UNITY_BUILD_SOURCES is being used where it is already disabled, e.g., qt_internal_add_test - Exclude all sources of a target from unity build if NO_UNITY_BUILD is set on the target. This sounds a bit harsh, but I have noticed that sometimes the same source file can be included somewhere else, and some unexpected collision may occur. - qt_examples_build_end excludes all its examples from the unity build. - qt_build_test now sets the CMAKE_UNITY_BUILD to OFF before configuring the tests, and restore its value when done. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ia42e7dd5a5bfb151db241deb639325720fd91eec Reviewed-by: Alexandru Croitor --- cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmake/QtBuildInternals/QtBuildInternalsConfig.cmake') diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index bb067c3e92..2ac1db6daf 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -689,6 +689,8 @@ function(qt_internal_get_standalone_tests_config_file_name out_var) endfunction() macro(qt_build_tests) + set(CMAKE_UNITY_BUILD OFF) + if(QT_BUILD_STANDALONE_TESTS) # Find location of TestsConfig.cmake. These contain the modules that need to be # find_package'd when testing. @@ -759,6 +761,8 @@ macro(qt_build_tests) add_subdirectory(manual) endif() endif() + + set(CMAKE_UNITY_BUILD ${QT_UNITY_BUILD}) endmacro() function(qt_compute_relative_path_from_cmake_config_dir_to_prefix) @@ -973,6 +977,7 @@ macro(qt_examples_build_end) if(TARGET Qt::Widgets) qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "uic") endif() + set_target_properties(${target} PROPERTIES UNITY_BUILD OFF) endforeach() install(CODE " -- cgit v1.2.3