qtgraphs defines a target in one directory, and then calls
qt_internal_extend_target with NO_UNITY_BUILD_SOURCES in another
subdirectory scope. That in turn calls set_source_files_properties
but only for the latter subdirectory, and not the main target
directory.
Because CMake has per-directory-scope source file properties, the
'no unity sources' option was effectively ignored.
When using CMake 3.18, make sure to specify the TARGET_DIRECTORY
option so that the source file properties are added to the scope of
the defining target.
Pick-to: 6.6 6.5
Change-Id: I4190d4073a2955aa7053b5faaaa57f683bc768a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 081e50d768114aeeb8f0d284989986d4debc6ec3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
- 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>
- The following commands accepts NO_UNITY_BUILD, and
NO_UNITY_BUILD_SOURCES arguments to opt out of the unity build, and
to exclude some source files from unity build, respectively.
- qt_internal_add_executable
- qt_internal_add_module
- qt_internal_add_plugin
- qt_internal_add_tool
- qt_internal_extend_target
- qt_internal_add_common_qt_library_helper
- qt_internal_add_cmake_library
- qt_internal_add_simd_part
- Unity build is disabled by default in these:
- qt_internal_add_test
- qt_internal_add_test_helper
- qt_internal_add_benchmark
- qt_internal_add_3rdparty_library
- qt_update_ignore_pch_source also excludes the files from unity_build
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I5d0e7df633738310a015142a6c73fbb78b6c3467
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>