Add optional support for ccache for MSVC (#9667)

This commit is contained in:
Magne Sjaastad 2023-01-13 07:57:13 +01:00 committed by GitHub
parent 14e06ac4f9
commit 3354630726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,20 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ##############################################################################
# OPTIONAL: Configuration of ccache for MSVC
# ##############################################################################
find_program(ccache_exe ccache)
if(ccache_exe)
file(COPY_FILE ${ccache_exe} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT)
set(CMAKE_VS_GLOBALS
"CLToolExe=cl.exe" "CLToolPath=${CMAKE_BINARY_DIR}"
"TrackFileAccess=false" "UseMultiToolTask=true"
"DebugInformationFormat=OldStyle"
)
endif()
# ##############################################################################
# Setup the main platform defines
# ##############################################################################