summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2019-09-19 17:22:43 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2019-09-19 17:33:20 +0000
commit25c53ce00ed1e4ea777d1b34552443b5e090a859 (patch)
tree00be4db6a243555abcbe2db3de17ebdff6919481 /cmake
parent13b54ea47710528d4d73f7d82bdc9acb47c4e25b (diff)
PCH: Only enable automatically for libraries/modules
Some tests are changing headers using defines inside the tests. Let's more closely mirror what qmake does to fix this. And it will also save quite a lot of space since most tests don't include all of e.g. QtCore Change-Id: I6f7e530f922418944d690bd2a1ee5f459ba755e1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index fc30e70418..3316fc4c30 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -976,8 +976,18 @@ function(extend_target target)
list(APPEND dbus_sources "${sources}")
endforeach()
+ get_target_property(target_type ${target} TYPE)
+ set(is_library FALSE)
+ if (${target_type} STREQUAL "STATIC_LIBRARY" OR ${target_type} STREQUAL "SHARED_LIBRARY")
+ set(is_library TRUE)
+ endif()
foreach(lib ${arg_PUBLIC_LIBRARIES} ${arg_LIBRARIES})
- qt_update_precompiled_header_with_library("${target}" "${lib}")
+ # Automatically generate PCH for 'target' using dependencies
+ # if 'target' is a library/module!
+ if (${is_library})
+ qt_update_precompiled_header_with_library("${target}" "${lib}")
+ endif()
+
string(REGEX REPLACE "_nolink$" "" base_lib "${lib}")
if(NOT base_lib STREQUAL lib)
qt_create_nolink_target("${base_lib}" ${target})