aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindCCache.cmake
blob: 956dee218d84c303178ce51d2714976d0208f406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#.rst:
# FindCCache
# ----------
# Finds ccache and sets it up as compiler wrapper.
# This should ideally be called before the call to project().
#
# See: https://crascit.com/2016/04/09/using-ccache-with-cmake/

find_program(CCACHE_PROGRAM ccache)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CCache REQUIRED_VARS CCACHE_PROGRAM)

if(CCACHE_FOUND)
  # Supports Unix Makefiles and Ninja
  set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
  set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()