# To detect if ccache is available
find_program(ccache_program_found "ccache")
if (ENABLE_CCACHE AND ccache_program_found)
    if (NOT $ENV{CCACHE_DIR} STREQUAL "")
        message(STATUS "CCACHE_DIR                      : $ENV{CCACHE_DIR}")
    else()
        message(STATUS "CCACHE_DIR                      : $ENV{HOME}/.ccache")
    endif()
    set(CMAKE_CXX_COMPILER_LAUNCHER "ccache")
elseif (ENABLE_CCACHE)
    message(STATUS "CCACHE                              : Enabled but not found")
    set(CMAKE_CXX_COMPILER_LAUNCHER)
else ()
    message(STATUS "CCACHE                              : OFF")
    set(CMAKE_CXX_COMPILER_LAUNCHER)
endif()
