Commit 6c2514da authored by Brad King's avatar Brad King
Browse files

MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and above

VS 2017 15.6 introduced support for this pragma.  Older MSVC versions
warn that it is unknown.

Fixes: #20692
parent 4c82f309
......@@ -331,13 +331,11 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_LINK_PCH ON)
if(MSVC_VERSION GREATER_EQUAL 1910)
# VS 2017 or greater
if (NOT ${CMAKE_${lang}_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_PCH_PROLOGUE "#pragma system_header")
else()
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
endif()
if (CMAKE_${lang}_COMPILER_ID STREQUAL "Clang")
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
elseif(MSVC_VERSION GREATER_EQUAL 1913)
# At least MSVC toolet 14.13 from VS 2017 15.6
set(CMAKE_PCH_PROLOGUE "#pragma system_header")
endif()
if (NOT ${CMAKE_${lang}_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_PCH_COPY_COMPILE_PDB ON)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment