diff --git a/Meta/CMake/setup_ccache.cmake b/Meta/CMake/setup_ccache.cmake index c581db1f5b8..c3306261557 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()