aboutsummaryrefslogtreecommitdiff
path: root/cmake/compiler
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-05-02 22:59:45 +0200
committerOvahlord <dreadkiller@gmx.de>2025-05-11 11:42:55 +0200
commitc80e4ab279586abce363116ce9929bbfc52a01dd (patch)
treeacc59044f2bd5cb968abce6a323f958fe89f6893 /cmake/compiler
parented0afee8fbe5156c7c21547365127165991da914 (diff)
Build: Remove -fpch-instantiate-templates detection, it is enabled by default since CMake 3.19
(cherry picked from commit 55a19f15d01b5f06c158f1dfbd2c43e4f5d6837c)
Diffstat (limited to 'cmake/compiler')
-rw-r--r--cmake/compiler/clang/settings.cmake13
1 files changed, 3 insertions, 10 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index 56f5c01d460..223e37799ea 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
# apple doesnt like to do the sane thing which would be to use the same version numbering as regular clang
# version number pulled from https://en.wikipedia.org/wiki/Xcode#Toolchain_versions for row matching LLVM 11
set(CLANG_EXPECTED_VERSION 12.0.5)
+ # enable -fpch-instantiate-templates for AppleClang (by default it is active only for regular clang)
+ set(CMAKE_C_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
+ set(CMAKE_CXX_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
@@ -160,13 +163,3 @@ if(BUILD_SHARED_LIBS)
message(STATUS "Clang: Disallow undefined symbols")
endif()
-
-# speedup PCH builds by forcing template instantiations during PCH generation
-set(CMAKE_REQUIRED_FLAGS "-fpch-instantiate-templates")
-check_cxx_source_compiles("int main() { return 0; }" CLANG_HAS_PCH_INSTANTIATE_TEMPLATES)
-unset(CMAKE_REQUIRED_FLAGS)
-if(CLANG_HAS_PCH_INSTANTIATE_TEMPLATES)
- target_compile_options(trinity-compile-option-interface
- INTERFACE
- -fpch-instantiate-templates)
-endif()