From 58d981b84fb2635d0c802e8b2cf32f2131db0024 Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 21 Oct 2026 10:27:20 +0200 Subject: [PATCH] Add ccache support for faster C/C++ rebuilds Detect ccache in CMakeLists.txt and use it as the C/C++ compiler launcher when available. No effect if ccache is not installed. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76a44a27..1460faba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,14 @@ cmake_minimum_required(VERSION 3.10) project(LibMC) +# Use ccache if available for faster rebuilds +find_program(CCACHE_PROGRAM ccache) +if(CCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + message(STATUS "Using ccache: ${CCACHE_PROGRAM}") +endif() + option(INCLUDE_DRIVERS "Include the drivers in the build" ON) option(INCLUDE_TESTS "Include the test system in the build" OFF) option(ENABLE_COVERAGE "Enable coverage instrumentation (GCC/Clang)" OFF)