CMake: Fix excessive size of precompiled header files

Do not add catch-all header files like QtCore, QtGui, etc. to
precompiled headers for targets that already define their own set of
precompiled header files.

This reduces the size of the precompiled headers and brings the pch file
sizes down into the region of the qmake build.

Pick-to: 6.2
Task-number: QTBUG-89122
Change-Id: I8e4d17aa6829c7d7b1aa01a01a61b6677e22c460
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
Joerg Bornemann 2021-08-23 21:12:36 +02:00
parent bae9aeacbe
commit 278368b523
1 changed files with 3 additions and 3 deletions

View File

@ -38,9 +38,9 @@ function(qt_internal_extend_target target)
set(is_library TRUE)
endif()
foreach(lib ${arg_PUBLIC_LIBRARIES} ${arg_LIBRARIES})
# Automatically generate PCH for 'target' using dependencies
# if 'target' is a library/module!
if (${is_library})
# Automatically generate PCH for 'target' using public dependencies.
# But only if 'target' is a library/module that does not specify its own PCH file.
if(NOT arg_PRECOMPILED_HEADER AND ${is_library})
qt_update_precompiled_header_with_library("${target}" "${lib}")
endif()