2017-06-15 18:23:30 +02:00
|
|
|
find_program(CCACHE_BIN NAMES ccache sccache)
|
2017-01-17 22:38:02 +01:00
|
|
|
if(CCACHE_BIN)
|
2024-06-08 16:05:14 +02:00
|
|
|
# Official ccache recommendation is to set CMAKE_C(XX)_COMPILER_LAUNCHER
|
|
|
|
if (NOT CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache")
|
|
|
|
list(INSERT CMAKE_C_COMPILER_LAUNCHER 0 "${CCACHE_BIN}")
|
|
|
|
# ccache uses -I when compiling without preprocessor, which makes clang complain.
|
|
|
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-01-17 22:38:02 +01:00
|
|
|
|
2024-06-08 16:05:14 +02:00
|
|
|
if (NOT CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache")
|
|
|
|
list(INSERT CMAKE_CXX_COMPILER_LAUNCHER 0 "${CCACHE_BIN}")
|
|
|
|
# ccache uses -I when compiling without preprocessor, which makes clang complain.
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
|
|
|
|
endif()
|
2017-01-17 22:38:02 +01:00
|
|
|
endif()
|
|
|
|
endif()
|