Skip to content

Commit

Permalink
CMake/Windows: Add PCH support
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed May 15, 2019
1 parent 481b7cd commit bab0008
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Source/PCH/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})

0 comments on commit bab0008

Please sign in to comment.