From cb24cf0aff2a77f89d0e622f3b008e10da2eea2a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 30 Aug 2026 14:49:41 -0400 Subject: [PATCH] Cmake: Add option to disable ccache Allow ccache usage to be disabled through the ENABLE_CCACHE CMake option, while preserving the existing automatic detection and Emscripten exclusion behavior. This is useful for builds where ccache is available but undesirable, (like Coverity) and provides clear configuration messages when ccache is skipped. Signed-off-by: Robin Getz --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b08f0cec..f305ae707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,8 +260,10 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") endif() endif() -find_program(CCACHE "ccache") -if(CCACHE AND NOT EMSCRIPTEN) +option(ENABLE_CCACHE "Enable ccache for faster builds" ON) +if (ENABLE_CCACHE) + find_program(CCACHE "ccache") + if(CCACHE AND NOT EMSCRIPTEN) message(STATUS "Using ccache ${CCACHE}") set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) @@ -269,6 +271,11 @@ if(CCACHE AND NOT EMSCRIPTEN) set(CMAKE_OBJCXX_COMPILER_LAUNCHER ${CCACHE}) endif() set(ENV{CCACHE_SLOPPINESS} pch_defines,time_macros) + else() + message(STATUS "Skipping ccache") + endif() +else() + message(STATUS "Disabled ccache") endif() set(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}" CACHE INTERNAL "")