From bd63f3d8f2bfc9576e4b42d4cfb1fac5e091fefe Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Thu, 8 Oct 2015 12:23:35 +0200 Subject: [PATCH] Add module for ccache support. It's based on information retrieved from: https://www.virag.si/2015/07/use-ccache-with-cmake-for-faster-compilation/ http://petereisentraut.blogspot.no/2011/05/ccache-and-clang.html --- modules/ccache.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/ccache.cmake diff --git a/modules/ccache.cmake b/modules/ccache.cmake new file mode 100644 index 0000000..ced3027 --- /dev/null +++ b/modules/ccache.cmake @@ -0,0 +1,27 @@ +#.rst: +# +# Adds ccache support. +# The user should export the appropriate environment variables to +# tweak the program's behaviour, as described in its manpage. +# Notice that some additional compiler flags might be needed in order +# to avoid unnecessary warnings. +# +# Variables defined:: +# +# CCACHE_FOUND +# +# autocmake.cfg configuration:: +# +# docopt: --ccache= Toggle use of ccache [default: ON]. +# define: '-DUSE_CCACHE="{0}"'.format(arguments['--ccache']) + +if(USE_CCACHE) + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + message(STATUS "Compiling with ccache") + else() + message(STATUS "ccache not available") + endif() +endif()