diff --git a/CMakeLists.txt b/CMakeLists.txt index 846d4d8ef..53b60fd3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,21 @@ find_program(CCACHE_EXE NAMES "ccache") if(CCACHE_EXE) option(USE_CCACHE "Enable CCache" ON) if(USE_CCACHE) - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXE}") + if (CMAKE_HOST_WIN32) + 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" + ) + else () + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXE}") + endif() endif() endif()