cmake: add ccache support

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel 2023-06-19 21:14:38 +02:00 committed by Jamie Reece Wilson
parent a5249753ce
commit a27da4aa22

View File

@ -38,6 +38,20 @@ option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library"
set(MPI_PROVIDER "LTM" CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM")
option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF)
#-----------------------------------------------------------------------------
# Add support for ccache if desired
#-----------------------------------------------------------------------------
find_program(CCACHE ccache)
if(CCACHE)
option(ENABLE_CCACHE "Enable ccache." ON)
endif()
# use ccache if installed
if(CCACHE AND ENABLE_CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
endif()
#-----------------------------------------------------------------------------
# Compose CFLAGS
#-----------------------------------------------------------------------------