A simple, Xcode compatible Ccache integration for CMake, based on this article by Craig Scott.
Ccache is a compiler cache that can drastically improve build times for C and C++ projects.
This script makes it easy to configure a CMake project to use Ccache by adding the configuration option USE_CCACHE which will active Ccache support when enabled.
Build-specific environmental variables can be set with the CCACHE_OPTIONS configuration parameter.
It is currently compatible with Makefile, Ninja and Xcode generators.
Example usage:
cmake . -DUSE_CCACHE=YES -DCCACHE_OPTIONS="CCACHE_CPP2=true;CCACHE_SLOPPINESS=clang_index_store"Using CPM.cmake (recommended)
Run the following from the project's root directory to add CPM to your project.
mkdir -p cmake
wget -O cmake/CPM.cmake https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/get_cpm.cmakeAdd the following lines to the project's CMakeLists.txt after calling project(...).
include(cmake/CPM.cmake)
CPMAddPackage("gh:TheLartians/[email protected]")Run the following from the project's root directory.
git submodule add https://github.com/TheLartians/Ccache.cmake In add the following lines to the project's CMakeLists.txt after calling project(...).
add_subdirectory(Ccache.cmake)Ccache.cmake requires CMake and Ccache.