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.
This commit is contained in:
Jan200101 2022-12-06 22:57:10 +01:00 committed by Andrew Kaster
parent 10d40af167
commit 483c18437b
Notes: sideshowbarker 2024-07-17 05:18:58 +09:00

View file

@ -2,8 +2,17 @@
# ccache setup # ccache setup
# #
list(APPEND COMPILERS
"CMAKE_C_COMPILER"
"CMAKE_CXX_COMPILER"
)
find_program(CCACHE_PROGRAM ccache) find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM) if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") foreach(compiler ${COMPILERS})
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache") 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() endif()