From 8cdf8dec703d882b46ca50a769fabb95ffc48e2c Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 24 Nov 2016 21:27:41 +0100 Subject: sync with upstream --- project/cmake/modules/FindCCache.cmake | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'project/cmake/modules/FindCCache.cmake') diff --git a/project/cmake/modules/FindCCache.cmake b/project/cmake/modules/FindCCache.cmake index 4ad7d07..a7fd29f 100644 --- a/project/cmake/modules/FindCCache.cmake +++ b/project/cmake/modules/FindCCache.cmake @@ -1,6 +1,18 @@ -find_program(CCACHE_FOUND ccache) -if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) -endif(CCACHE_FOUND) +#.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() -- cgit v1.2.3