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/QtBuildInternals/QtBuildInternalsConfig.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/QtBuildInternals/QtBuildInternalsConfig.cmake')
-rw-r--r-- | cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 5 |
1 files changed, 5 insertions, 0 deletions
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 " |