2023-03-23 14:11:09 +00:00
|
|
|
# OBS CMake ccache module
|
|
|
|
|
2023-04-28 13:35:17 +00:00
|
|
|
include_guard(GLOBAL)
|
|
|
|
|
2023-03-23 14:11:09 +00:00
|
|
|
if(NOT DEFINED CCACHE_PROGRAM)
|
2023-09-08 22:23:44 +00:00
|
|
|
message(DEBUG "Trying to find ccache on build host")
|
2023-03-23 14:11:09 +00:00
|
|
|
find_program(CCACHE_PROGRAM "ccache")
|
|
|
|
mark_as_advanced(CCACHE_PROGRAM)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CCACHE_PROGRAM)
|
2023-09-08 22:23:44 +00:00
|
|
|
message(DEBUG "Trying to find ccache on build host - done")
|
|
|
|
message(DEBUG "Ccache found as ${CCACHE_PROGRAM}")
|
2023-03-23 14:11:09 +00:00
|
|
|
option(ENABLE_CCACHE "Enable compiler acceleration with ccache" ON)
|
|
|
|
|
|
|
|
if(ENABLE_CCACHE)
|
|
|
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
2023-04-24 16:09:11 +00:00
|
|
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
2023-03-23 14:11:09 +00:00
|
|
|
set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
|
|
|
set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
|
|
|
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
|
|
|
endif()
|
2023-09-08 22:23:44 +00:00
|
|
|
else()
|
|
|
|
message(DEBUG "Trying to find ccache on build host - skipped")
|
2023-03-23 14:11:09 +00:00
|
|
|
endif()
|