aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindCCache.cmake
blob: a7fd29fabae5a082e8bcbe42965d4f802ebb34f7 (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()