From 3307397da14b543a289191c23af9a61fb32eeb46 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 25 Jul 2022 14:01:41 -0700 Subject: [PATCH] CMake: Set the correct variables for ccache. As the RULE_LAUNCH_COMPILE documentation says, "Note: This property is intended for internal use by ctest(1). Projects and developers should use the _COMPILER_LAUNCHER target properties or the associated CMAKE__COMPILER_LAUNCHER variables instead." --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f442fd049..a02ce4a907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1492,11 +1492,12 @@ if(ENABLE_CCACHE) message(WARNING "Ccache is enabled, but your compiler is ${CMAKE_C_COMPILER_ID}." " We wish you the best of luck.") endif() - # https://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake/24305849#24305849 find_program(CCACHE_EXECUTABLE ccache) if(CCACHE_EXECUTABLE) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXECUTABLE}") - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_LINKER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_EXECUTABLE}") endif() endif()