From 10d40af16743df93de58e4d9fac51139b7e3130d Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Tue, 6 Dec 2022 22:57:20 +0100 Subject: [PATCH] Meta: Separate ccache setup into its own component --- CMakeLists.txt | 6 +----- Meta/CMake/setup_ccache.cmake | 9 +++++++++ Meta/Lagom/CMakeLists.txt | 6 +----- 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 Meta/CMake/setup_ccache.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index caa641ea78..b0a2201a4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,7 @@ if(NOT COMMAND serenity_option) endif() include(serenity_options) -find_program(CCACHE_PROGRAM ccache) -if(CCACHE_PROGRAM) - set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") -endif() +include(setup_ccache) if (NOT HACKSTUDIO_BUILD) diff --git a/Meta/CMake/setup_ccache.cmake b/Meta/CMake/setup_ccache.cmake new file mode 100644 index 0000000000..c581db1f5b --- /dev/null +++ b/Meta/CMake/setup_ccache.cmake @@ -0,0 +1,9 @@ +# +# ccache setup +# + +find_program(CCACHE_PROGRAM ccache) +if(CCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") +endif() \ No newline at end of file diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 8fa1a117da..56cfcbe139 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -49,11 +49,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON find_package(Threads REQUIRED) if (ENABLE_LAGOM_CCACHE) - find_program(CCACHE_PROGRAM ccache) - if(CCACHE_PROGRAM) - set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") - endif() + include(setup_ccache) endif() if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ)