kubbebrowser/cmake/KubbeCompilerCache.cmake

22 lines
705 B
CMake

function(kubbe_configure_compiler_cache)
if(NOT KUBBE_ENABLE_CCACHE)
return()
endif()
set(_kubbe_local_ccache "${PROJECT_SOURCE_DIR}/.toolchains/ccache/current/ccache")
if(EXISTS "${_kubbe_local_ccache}")
set(_kubbe_ccache "${_kubbe_local_ccache}")
else()
find_program(_kubbe_ccache ccache)
endif()
if(_kubbe_ccache)
set(CMAKE_C_COMPILER_LAUNCHER "${_kubbe_ccache}" PARENT_SCOPE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${_kubbe_ccache}" PARENT_SCOPE)
message(STATUS "Kubbe compiler cache: ${_kubbe_ccache}")
else()
message(STATUS "Kubbe compiler cache: unavailable (build remains functional)")
endif()
endfunction()