diff --git a/CMakeLists.txt b/CMakeLists.txt index c2e78143c..dfff0b8a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ project( VERSION 0.9.0) include(cmake/PreventInSourceBuilds.cmake) +include(cmake/CCache.cmake) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/cmake/CCache.cmake b/cmake/CCache.cmake new file mode 100644 index 000000000..a9e67ad7e --- /dev/null +++ b/cmake/CCache.cmake @@ -0,0 +1,10 @@ +# Enable ccache + +find_program(CCACHE_PROGRAM ccache) + +if(CCACHE_PROGRAM) + option(${PROJECT_NAME}_enable_ccache "Enable ccache" ON) + if(${PROJECT_NAME}_enable_ccache) + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + endif() +endif()