primehack/CMake/CCache.cmake
Florent Castelli 712b078a5b
cmake: Search for sccache too in CCache module
sccache is a ccache rewrite that supports GCC, Clang and MSVC.
2021-04-24 17:59:34 +02:00

11 lines
464 B
CMake

find_program(CCACHE_BIN NAMES ccache sccache)
if(CCACHE_BIN)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_BIN})
# ccache uses -I when compiling without preprocessor, which makes clang complain.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif()