summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtInternalTargets.cmake5
-rw-r--r--cmake/QtPrecompiledHeadersHelpers.cmake12
2 files changed, 16 insertions, 1 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index 45e75d4836f..f0d7d06fb84 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -385,7 +385,10 @@ if(QT_FEATURE_stdlib_libcpp)
target_compile_definitions(PlatformCommonInternal INTERFACE _LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
endif()
-if(QT_USE_CCACHE AND CLANG AND BUILD_WITH_PCH)
+if((QT_USE_CCACHE
+ OR (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "^(.*[/\\])?sccache$"))
+ AND CLANG
+ AND BUILD_WITH_PCH)
# The ccache man page says we must compile with -fno-pch-timestamp when using clang and pch.
foreach(language IN ITEMS C CXX OBJC OBJCXX)
target_compile_options(PlatformCommonInternal INTERFACE
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()