diff --git a/cmake/SimutransCompileOptions.cmake b/cmake/SimutransCompileOptions.cmake index 4f47327cb70..96f091dfcf9 100644 --- a/cmake/SimutransCompileOptions.cmake +++ b/cmake/SimutransCompileOptions.cmake @@ -5,8 +5,14 @@ if (CCache_FOUND) option(SIMUTRANS_USE_CCACHE "Use CCache compiler cache to improve recompilation speed" ON) if (SIMUTRANS_USE_CCACHE) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCache_EXECUTABLE}") - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCache_EXECUTABLE}") + if (NOT CMAKE_C_COMPILER_LAUNCHER) + message(STATUS "Using ccache for C compilation: ${CCache_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER ${CCache_EXECUTABLE}) + endif () + if (NOT CMAKE_CXX_COMPILER_LAUNCHER) + message(STATUS "Using ccache for C++ compilation: ${CCache_EXECUTABLE}") + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCache_EXECUTABLE}) + endif () endif (SIMUTRANS_USE_CCACHE) endif (CCache_FOUND)