From ffcfe60711d61eecc45abef70dddba28af6b9a0c Mon Sep 17 00:00:00 2001 From: silverqx Date: Fri, 20 Oct 2023 18:29:52 +0200 Subject: [PATCH] cmake avoided possible disabled PCH Restrict disabling PCH if the ccache is used as the compiler launcher with the MSVC compiler. --- cmake/CommonModules/TinyHelpers.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/CommonModules/TinyHelpers.cmake b/cmake/CommonModules/TinyHelpers.cmake index 11db561c4..60f5d2499 100644 --- a/cmake/CommonModules/TinyHelpers.cmake +++ b/cmake/CommonModules/TinyHelpers.cmake @@ -458,8 +458,6 @@ function(tiny_fix_ccache_msvc) # anyway but I will replace the Zi to Z7 compiler option in both # CMAKE__FLAGS_ to be consistent 🤔 - tiny_disable_precompile_headers() - # Fix the MSVC debug information format by the CMake version set(isNewMsvcDebugInformationFormat FALSE) tiny_is_new_msvc_debug_information_format_325(isNewMsvcDebugInformationFormat) @@ -472,6 +470,13 @@ function(tiny_fix_ccache_msvc) tiny_fix_ccache_msvc_324() endif() + # Don't disable PCH if no fixes were applied + # The new MSVC debug information format flags method also supports multi-config generators + # The old replace /Zi by /Z7 method doesn't support multi-config generators + if(isNewMsvcDebugInformationFormat OR NOT TINY_IS_MULTI_CONFIG) + tiny_disable_precompile_headers() + endif() + endfunction() # Determine if the current platform needs fixes and the CMAKE_CXX_COMPILER_LAUNCHER