diff --git a/.travis.yml b/.travis.yml index 910c0db..0b849bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ sudo: required dist: trusty language: c +cache: ccache compiler: - gcc - clang diff --git a/CMakeLists.txt b/CMakeLists.txt index b70368d..34b4e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ include(cmake/FindSDL2.cmake) include(cmake/FindSDL2_image.cmake) include(cmake/FindSDL2_ttf.cmake) include(cmake/FindSDL2_mixer.cmake) +include(cmake/FindCCache.cmake) if (NOT WIN32) include(FindX11) diff --git a/cmake/FindCCache.cmake b/cmake/FindCCache.cmake new file mode 100644 index 0000000..0d1985f --- /dev/null +++ b/cmake/FindCCache.cmake @@ -0,0 +1,17 @@ +# 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() \ No newline at end of file