From bab00088d4032a482bb5c4960328e62014c565d2 Mon Sep 17 00:00:00 2001 From: spycrab Date: Wed, 15 May 2019 19:28:04 +0200 Subject: [PATCH] CMake/Windows: Add PCH support --- Source/CMakeLists.txt | 4 ++++ Source/PCH/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 Source/PCH/CMakeLists.txt diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d6f475fe2..69ca995ecc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -46,6 +46,10 @@ if (MSVC) # All files are encoded as UTF-8 add_compile_options(/utf-8) + # Use PCH + add_subdirectory(PCH) + add_definitions(/I${PCH_DIRECTORY}) + add_definitions(/Yu${PCH_PATH}) endif() # These aren't actually needed for C11/C++11 diff --git a/Source/PCH/CMakeLists.txt b/Source/PCH/CMakeLists.txt new file mode 100644 index 0000000000..0e214789ad --- /dev/null +++ b/Source/PCH/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(pch pch.h pch.cpp) +set(PCH_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set(PCH_NAME ${PCH.pch}) +target_compile_options(pch PUBLIC /Ycpch.h /Fp${PCH_DIRECTORY}/${PCH_NAME}) \ No newline at end of file