Enable ccache by default if available

This commit is contained in:
Marcus Holland-Moritz 2023-06-25 17:49:18 +02:00
parent 3c4730aa69
commit a0635d7ab6

View File

@ -37,6 +37,7 @@ option(PREFER_SYSTEM_LIBARCHIVE "use system libarchive if available" OFF)
option(PREFER_SYSTEM_ZSTD "use system zstd if available" OFF)
option(PREFER_SYSTEM_XXHASH "use system xxHash if available" OFF)
option(PREFER_SYSTEM_GTEST "use system gtest if available" OFF)
option(DISABLE_CCACHE "disable ccache" OFF)
option(STATIC_BUILD_DO_NOT_USE "try static build (experimental)" OFF)
if(DEFINED ENV{DWARFS_LOCAL_REPO_PATH})
@ -49,6 +50,14 @@ else()
set(LIBARCHIVE_GIT_REPO https://github.com/libarchive/libarchive.git)
endif()
if(NOT DISABLE_CCACHE)
find_program(CCACHE_EXE ccache)
if(CCACHE_EXE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE})
endif()
endif()
if(DEFINED ENV{CCACHE_PREFIX})
add_compile_options(-Wno-gnu-line-marker)
endif()