diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | cmake/QtAutoDetect.cmake | 17 | ||||
-rw-r--r-- | cmake/QtPostProcess.cmake | 4 |
3 files changed, 21 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bc704bc73..b11c4bd93b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,9 +46,6 @@ if(NOT QT_BUILD_STANDALONE_TESTS) ## Should this Qt be built with Werror? option(WARNINGS_ARE_ERRORS "Build Qt with warnings as errors" ${FEATURE_developer_build}) - ## Should Qt be built using PCH? - option(BUILD_WITH_PCH "Build Qt using precompiled headers?" ON) - ## QtBase specific configure tests: include(QtBaseConfigureTests) 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() diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index 531feb0ca0..9b1769455d 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -361,6 +361,10 @@ function(qt_generate_build_internals_extra_cmake_code) string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "set(CMAKE_DEFAULT_BUILD_TYPE \"${CMAKE_DEFAULT_BUILD_TYPE}\" CACHE STRING \"\")\n") endif() + if(DEFINED BUILD_WITH_PCH) + string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS + "set(BUILD_WITH_PCH \"${BUILD_WITH_PCH}\" CACHE STRING \"\")\n") + endif() qt_generate_install_prefixes(install_prefix_content) |