CompilerCache find/use module
This is work based on https://crascit.com/2016/04/09/using-ccache-with-cmake. The is a fair about of setup to get CCache and similar tools to work in a CMake build environment, especially with newer versions of GCC/Clang mixed with older versions of CCache, or with Xcode.
The first step in an upstream solution will be to teach Xcode the
about the CMAKE_<LANG>_COMPILER_LAUNCHER
variable.
For the current external solution:
While the solution is fairly simple, there are several choices for design:
- An
include(CompilerCache)
file that automatically setups up compiler caches. This works great for most use cases, but is not flexible. An example of that is at https://github.com/CLIUtils/cmake/blob/master/CCache.cmake - An
include(CompilerCache)
file that provides a function that setups up compiler caches. This is the most flexible and can support different programs or different paths. An early version, incomplet and inkorrect, is available at https://gitlab.kitware.com/henryiii/cmake/blob/cache/Modules/UseCompilerCache.cmake. - A
find_program(CompilerCache)
that finds CCache then provides a function like seen above. Might be a similarly good solution. I'm happy to convert to that if desired. However, might be a little harder to be flexible for things like ClCache.
Edited by Henry Schreiner