From bc4f8f4472ae94b7053ee373a7406774900f350c Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 3 Oct 2019 14:43:00 +0200 Subject: PCH: Use clang's own pch functionality instead of the GCC emulation Fixes: #19786 --- Modules/Compiler/Clang.cmake | 3 +++ Modules/Platform/Windows-Clang.cmake | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 45c33fb..ea5a3b3 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -97,6 +97,9 @@ else() "\"${__ranlib}\" " ) + set(CMAKE_PCH_EXTENSION .pch) set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang ) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang ) endmacro() endif() diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 84b3a9b..f226553 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -83,9 +83,10 @@ macro(__windows_compiler_clang_gnu lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") - set(CMAKE_PCH_EXTENSION .gch) - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include ) - set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include ) + set(CMAKE_PCH_EXTENSION .pch) + set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang ) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang ) unset(__ADDED_FLAGS) unset(__ADDED_FLAGS_DEBUG) -- cgit v0.12