build: enable ccache for MSVC

ccache supports MSVC now, so don't disable it for MSVC builds.

Remove the global RULE_LAUNCH_COMPILE property because it breaks
resource compilation on MSVC and just use CMAKE_CXX_COMPILER_LAUNCHER
etc..

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-06-15 01:00:13 +00:00
parent 72d772189a
commit 3e224bab40
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 1 additions and 2 deletions

View File

@ -59,12 +59,11 @@ endif()
# Use ccache if available and not already enabled on the command line. # Use ccache if available and not already enabled on the command line.
# This has to be done before the project() call. # This has to be done before the project() call.
if(NOT (VCPKG_TARGET_TRIPLET OR CMAKE_CXX_COMPILER_LAUNCHER OR CMAKE_CXX_COMPILER MATCHES ccache)) if(NOT CMAKE_CXX_COMPILER_LAUNCHER)
find_program(CCACHE_EXECUTABLE ccache) find_program(CCACHE_EXECUTABLE ccache)
if(CCACHE_EXECUTABLE) if(CCACHE_EXECUTABLE)
message(STATUS "Enabling ccache") message(STATUS "Enabling ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_EXECUTABLE})
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C compiler launcher" FORCE) set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C compiler launcher" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C++ compiler launcher" FORCE) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C++ compiler launcher" FORCE)
set(CMAKE_ASM_NASM_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "nasm assembler launcher" FORCE) set(CMAKE_ASM_NASM_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "nasm assembler launcher" FORCE)