| 1 |
find_program(CCACHE_BIN NAMES ccache sccache) |
| 2 |
if(CCACHE_BIN) |
| 3 |
set(_CCACHE_SUPPORTED_LAUCHERS C CXX OBJC OBJCXX) |
| 4 |
foreach(LAUNCHER ${_CCACHE_SUPPORTED_LAUCHERS}) |
| 5 |
if (NOT CMAKE_${LAUNCHER}_COMPILER_LAUNCHER MATCHES "ccache") |
| 6 |
list(INSERT CMAKE_${LAUNCHER}_COMPILER_LAUNCHER 0 ${CCACHE_BIN}) |
| 7 |
endif() |
| 8 |
# ccache uses -I when compiling without preprocessor, which makes clang complain. |
| 9 |
if("${CMAKE_${LAUNCHER}_COMPILER_ID}" MATCHES "Clang") |
| 10 |
set(CMAKE_${LAUNCHER}_FLAGS "${CMAKE_${LAUNCHER}_FLAGS} -Qunused-arguments -fcolor-diagnostics") |
| 11 |
endif() |
| 12 |
endforeach() |
| 13 |
endif() |