diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-07-13 10:07:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-28 15:47:40 (GMT) |
commit | b8626261e95e0f99c9227d619671822f9a60ef1a (patch) | |
tree | bb3b915854ac4ff9b01515642521b2940b02ec38 /Modules/Platform/Windows-MSVC.cmake | |
parent | 375d01c6808713a0cfeef9ea092c8236ba063525 (diff) | |
download | CMake-b8626261e95e0f99c9227d619671822f9a60ef1a.zip CMake-b8626261e95e0f99c9227d619671822f9a60ef1a.tar.gz CMake-b8626261e95e0f99c9227d619671822f9a60ef1a.tar.bz2 |
Precompile headers: Add methods to generate PCH sources
Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
Diffstat (limited to 'Modules/Platform/Windows-MSVC.cmake')
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 7a83859..6ddcaa3 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -329,6 +329,15 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + set(CMAKE_PCH_EXTENSION .pch) + set(CMAKE_LINK_PCH ON) + if(MSVC_VERSION GREATER_EQUAL 1910) + # VS 2017 or greater + set(CMAKE_PCH_PROLOGUE "#pragma system_header") + endif() + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH /Yu<PCH_HEADER> /FI<PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH /Yc<PCH_HEADER> /FI<PCH_HEADER>) + if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) |