summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTobias Hieta <tobias@plex.tv>2020-08-28 07:16:04 (GMT)
committerTobias Hieta <tobias@plex.tv>2020-09-02 06:30:55 (GMT)
commit8c8f03422e3197a3414a8ed1413fcb9576df0f4b (patch)
tree526e5b6341f3f63dd848623be82448fab17f5285 /Modules
parent8c833ff0e17e63d9cbf17622abcb70a5fab240b8 (diff)
downloadCMake-8c8f03422e3197a3414a8ed1413fcb9576df0f4b.zip
CMake-8c8f03422e3197a3414a8ed1413fcb9576df0f4b.tar.gz
CMake-8c8f03422e3197a3414a8ed1413fcb9576df0f4b.tar.bz2
PCH: Template instantiation support
Adds PCH_INSTANTIATE_TEMPLATES target property for enabling template instantiation in precompiled headers. Enabled by default. Currently only supported for Clang 11 and newer. Implements #21133.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Compiler/Clang.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 52d5350..6f0e9b3 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -101,6 +101,9 @@ else()
if (NOT CMAKE_GENERATOR MATCHES "Xcode")
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
endif()
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.0 AND NOT __is_apple_clang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
+ endif()
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
endmacro()