summaryrefslogtreecommitdiffstats
path: root/cmake/QtAutoDetect.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-24 11:19:21 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-25 10:46:46 +0100
commit0446bf5ba30b83bb85144f67e8c3b151d9a8cbca (patch)
tree0d343127970efd6b6fe7919c6b80d3e61684a816 /cmake/QtAutoDetect.cmake
parent874c6b00dd52a62633a8afb5c1749b2ab50db6b6 (diff)
CMake: Fix auto-detection of precompiled header support
PCH files were only used while building qtbase. Make sure the value is exported to the BuildInternalsConfig file, so the value is re-used when building other repositories. Also disable PCH when building simulator_and_device iOS builds, because CMake doesn't currently generate separate PCH files per architecture. Change-Id: I79955ebc557b800bc3c704deac519fe80012c229 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake/QtAutoDetect.cmake')
-rw-r--r--cmake/QtAutoDetect.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake
index b600c709a8..6f06c48984 100644
--- a/cmake/QtAutoDetect.cmake
+++ b/cmake/QtAutoDetect.cmake
@@ -202,8 +202,25 @@ function(qt_auto_detect_darwin)
endif()
endfunction()
+function(qt_auto_detect_pch)
+ set(default_value "ON")
+
+ if(CMAKE_OSX_ARCHITECTURES)
+ list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
+ # CMake doesn't currently support PCH when multiple architecture are set. This is the
+ # case for simulator_and_device builds.
+ if(arch_count GREATER 1)
+ set(default_value "OFF")
+ message(WARNING "PCH support disabled due to usage of multiple architectures.")
+ endif()
+ endif()
+
+ option(BUILD_WITH_PCH "Build Qt using precompiled headers?" "${default_value}")
+endfunction()
+
qt_auto_detect_cmake_config()
qt_auto_detect_darwin()
qt_auto_detect_ios()
qt_auto_detect_android()
qt_auto_detect_vpckg()
+qt_auto_detect_pch()