From c7e1e947486411f1c761addb30684bcf2554f6df Mon Sep 17 00:00:00 2001 From: Cody Northrop Date: Tue, 31 Oct 2017 17:05:03 -0600 Subject: [PATCH] build: Add optional ccache support to cmake --- BUILD.md | 2 ++ CMakeLists.txt | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/BUILD.md b/BUILD.md index bb78c9c..8b884c9 100644 --- a/BUILD.md +++ b/BUILD.md @@ -40,6 +40,8 @@ cd dbuild make ``` +If your build system supports ccache, you can enable that via cmake option `-DUSE_CCACHE=On` + If you have installed a Vulkan driver obtained from your graphics hardware vendor, the install process should have configured the driver so that the Vulkan loader can find and load it. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2412236..8b91674 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,15 @@ string(TOLOWER ${API_NAME} API_LOWERCASE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(PythonInterp 3 REQUIRED) +option(USE_CCACHE "Use ccache" OFF) +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) + endif(CCACHE_FOUND) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(FALLBACK_CONFIG_DIRS "/etc/xdg" CACHE STRING "Search path to use when XDG_CONFIG_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant.") -- 2.7.4