diff --git a/CMakeLists.txt b/CMakeLists.txt index 39ce9e2c3f7..82ff10e2cd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -426,6 +426,18 @@ if(CONFIG_ARCH_BOARD_COMMON) "${NUTTX_DIR}/boards/${CONFIG_ARCH}/${CONFIG_ARCH_CHIP}/common") endif() +# Setup ccache ############################################################### + +if(CONFIG_CCACHE) + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + message(STATUS "Using ccache: ${CCACHE_PROGRAM}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + else() + message(STATUS "Could not find ccache, skipping!") + endif() +endif() + # Setup toolchain ############################################################ # This needs to happen before project() when binaries are searched for