diff options
author | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-03-09 14:53:14 +0100 |
---|---|---|
committer | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-03-14 17:28:44 +0100 |
commit | 360293623094a31586981206e59c92aa6235163d (patch) | |
tree | 19fb1bdcf87a1c9ece0714b5483baab76c586e2f /cmake/QtTargetHelpers.cmake | |
parent | cfed6587476712b67d9de3fd67d708651d827690 (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/QtTargetHelpers.cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index 930fbc884f..b4cd5c81ae 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -212,11 +212,16 @@ function(qt_internal_extend_target target) DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}) qt_update_precompiled_header("${target}" "${arg_PRECOMPILED_HEADER}") + ## Also exclude them from unity build qt_update_ignore_pch_source("${target}" "${arg_NO_PCH_SOURCES}") - qt_update_ignore_unity_build_sources("${target}" "${arg_NO_UNITY_BUILD_SOURCES}") ## Ignore objective-c files for PCH (not supported atm) qt_ignore_pch_obj_c_sources("${target}" "${arg_SOURCES}") + qt_update_ignore_unity_build_sources("${target}" "${arg_NO_UNITY_BUILD_SOURCES}") + if(arg_NO_UNITY_BUILD) + set_target_properties("${target}" PROPERTIES UNITY_BUILD OFF) + qt_update_ignore_unity_build_sources("${target}" "${arg_SOURCES}") + endif() else() if(QT_CMAKE_DEBUG_EXTEND_TARGET) message("qt_extend_target(${target} CONDITION ${arg_CONDITION} ...): Skipped") @@ -234,9 +239,6 @@ function(qt_internal_extend_target target) ${sources_property} "${arg_CONDITION_INDEPENDENT_SOURCES}") endif() - if(arg_NO_UNITY_BUILD) - set_target_properties(${target} PROPERTIES UNITY_BUILD OFF) - endif() endfunction() function(qt_is_imported_target target out_var) |