summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-12-06 22:57:10 +0100
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-12 21:34:09 -0700
commit483c18437b1e9c8bd2903726ba782c732eee440d (patch)
treed51c8dc06463388c8b068d6ccc749a32748e9e8c
parent10d40af16743df93de58e4d9fac51139b7e3130d (diff)
downloadserenity-483c18437b1e9c8bd2903726ba782c732eee440d.zip
Meta: Detect ccache being passed as the compiler
This prevents ccache from being invoking itself. Icecc fails to ran this way because of recursion detection.
-rw-r--r--Meta/CMake/setup_ccache.cmake15
1 files changed, 12 insertions, 3 deletions
diff --git a/Meta/CMake/setup_ccache.cmake b/Meta/CMake/setup_ccache.cmake
index c581db1f5b..c330626155 100644
--- a/Meta/CMake/setup_ccache.cmake
+++ b/Meta/CMake/setup_ccache.cmake
@@ -2,8 +2,17 @@
# ccache setup
#
+list(APPEND COMPILERS
+ "CMAKE_C_COMPILER"
+ "CMAKE_CXX_COMPILER"
+)
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
+ foreach(compiler ${COMPILERS})
+ get_filename_component(compiler_path "${${compiler}}" REALPATH)
+ get_filename_component(compiler_name "${compiler_path}" NAME)
+ if (NOT ${compiler_name} MATCHES "ccache")
+ set("${compiler}_LAUNCHER" "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
+ endif()
+ endforeach()
+endif()