summaryrefslogtreecommitdiffstats
path: root/cmake/QtTestHelpers.cmake
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-03-09 14:53:14 +0100
committerAmir Masoud Abdol <amir.abdol@qt.io>2023-03-14 17:28:44 +0100
commit360293623094a31586981206e59c92aa6235163d (patch)
tree19fb1bdcf87a1c9ece0714b5483baab76c586e2f /cmake/QtTestHelpers.cmake
parentcfed6587476712b67d9de3fd67d708651d827690 (diff)
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtTestHelpers.cmake')
-rw-r--r--cmake/QtTestHelpers.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 60b9687d2f..df477f53fe 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -15,6 +15,7 @@ function(qt_internal_add_benchmark target)
"${__qt_internal_add_executable_multi_args}"
)
_qt_internal_validate_all_args_are_parsed(arg)
+ _qt_internal_validate_no_unity_build(arg)
qt_remove_args(exec_args
ARGS_TO_REMOVE
@@ -239,6 +240,8 @@ function(qt_internal_add_test_to_batch batch_name name)
arg "${optional_args}" "${single_value_args}" "${multi_value_args}" ${ARGN})
qt_internal_prepare_test_target_flags(version_arg exceptions_text gui_text ${ARGN})
+ _qt_internal_validate_no_unity_build(arg)
+
_qt_internal_test_batch_target_name(target)
# Lazy-init the test batch
@@ -324,6 +327,7 @@ function(qt_internal_add_test_to_batch batch_name name)
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
NO_UNITY_BUILD # Tests should not be built using UNITY_BUILD
+ NO_UNITY_BUILD_SOURCES ${arg_SOURCES}
)
foreach(source ${arg_SOURCES})
@@ -426,6 +430,7 @@ function(qt_internal_add_test name)
"${multi_value_args}"
)
_qt_internal_validate_all_args_are_parsed(arg)
+ _qt_internal_validate_no_unity_build(arg)
set(batch_current_test FALSE)
if(QT_BUILD_TESTS_BATCHED AND NOT arg_NO_BATCH AND NOT arg_QMLTEST AND NOT arg_MANUAL