summaryrefslogtreecommitdiffstats
path: root/cmake/QtPrecompiledHeadersHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <[email protected]>2025-12-12 17:50:20 +0100
committerJoerg Bornemann <[email protected]>2025-12-13 10:47:20 +0100
commit2d65847d6473ef164f61f7cc2257387f41cd5efc (patch)
treefed2c8e80a630944d0dcf9a2e554083e2cee670c /cmake/QtPrecompiledHeadersHelpers.cmake
parent215ad9cac1c431638567a5ccb6dd2359f32038b5 (diff)
CMake: Adjust PCH generation for linked private Qt modulesHEADdev
QtMultimediaQuick links against QtMultimediaPrivate. Since QtMultimediaPrivate is an interface library, we did not add its master header to the precompiled headers of QtMultimediaQuick. However, it's likely that if one uses a private module then headers of the public module are used. Now, we don't discard all interface libraries in qt_update_precompiled_header_with_library but - detect if it's a private Qt module - retrieve the public Qt module target - call qt_update_precompiled_header_with_library with that Fixes: QTBUG-142078 Change-Id: Ic0eff21b8265cd622202efdd4ffd878e1f1fdea1 Reviewed-by: Alexandru Croitor <[email protected]>
Diffstat (limited to 'cmake/QtPrecompiledHeadersHelpers.cmake')
-rw-r--r--cmake/QtPrecompiledHeadersHelpers.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtPrecompiledHeadersHelpers.cmake b/cmake/QtPrecompiledHeadersHelpers.cmake
index b47e4e74e33..7fe94664da3 100644
--- a/cmake/QtPrecompiledHeadersHelpers.cmake
+++ b/cmake/QtPrecompiledHeadersHelpers.cmake
@@ -14,6 +14,18 @@ function(qt_update_precompiled_header_with_library target library)
get_target_property(target_type "${library}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
+ # If target links against QtFooPrivate then QtFoo is transitively pulled
+ # in. We assume that headers from QtFoo will be used and add this
+ # library to the target's precompiled headers too.
+ get_target_property(is_private_module "${library}" _qt_is_private_module)
+ if(is_private_module)
+ get_target_property(public_module_target "${library}" _qt_public_module_target_name)
+ qt_update_precompiled_header_with_library("${target}"
+ "${QT_CMAKE_EXPORT_NAMESPACE}::${public_module_target}"
+ )
+ endif()
+
+ # Don't handle interface libraries any further.
return()
endif()