Skip to content

Commit

Permalink
Use CMAKE_<lang>_COMPILER_LAUNCHER for CCache
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Feb 24, 2023
1 parent e147936 commit eef1a5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ endif ()
set(MP_CMAKE_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/support/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MP_CMAKE_MODULE_DIR})

## Use CCache to optimize recompilation
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
set(CMAKE_Fortran_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
else()
message(STATUS " HINT: Install ccache for faster recompilation")
endif()

include(init)
Expand Down

0 comments on commit eef1a5f

Please sign in to comment.