CMake: Disable PCH on MSVC + Buildcache configs

This commit is contained in:
ameerj 2022-11-29 23:01:32 -05:00
parent 37bc5118ea
commit 51358d2b5e
2 changed files with 14 additions and 4 deletions

View File

@ -66,6 +66,20 @@ elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "")
include("$ENV{VCPKG_TOOLCHAIN_FILE}") include("$ENV{VCPKG_TOOLCHAIN_FILE}")
endif() endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
if (MSVC AND CCACHE)
# buildcache does not properly cache PCH files, leading to compilation errors.
# See https://github.com/mbitsnbites/buildcache/discussions/230
message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH")
set(YUZU_USE_PRECOMPILED_HEADERS OFF)
endif()
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
message(STATUS "Using Precompiled Headers.")
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
endif()
# Default to a Release build # Default to a Release build
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)

View File

@ -152,10 +152,6 @@ else()
endif() endif()
endif() endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
endif()
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(audio_core) add_subdirectory(audio_core)