WIP: Adding compiler cache
This is an MR 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.
While the solution is fairly simple, there are several choices for design:
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
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 in this MR at the moment.
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.
What do you think?