Skip to content

Commit 93f5348

Browse files
committed
cmake: add ccache support
Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent a2245e8 commit 93f5348

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library"
3838
set(MPI_PROVIDER "LTM" CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM")
3939
option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF)
4040

41+
#-----------------------------------------------------------------------------
42+
# Add support for ccache if desired
43+
#-----------------------------------------------------------------------------
44+
find_program(CCACHE ccache)
45+
46+
if(CCACHE)
47+
option(ENABLE_CCACHE "Enable ccache." ON)
48+
endif()
49+
50+
# use ccache if installed
51+
if(CCACHE AND ENABLE_CCACHE)
52+
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
53+
endif()
54+
4155
#-----------------------------------------------------------------------------
4256
# Compose CFLAGS
4357
#-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)