When using the RULE_LAUNCH_COMPILE and RULE_LAUNCH_LINK properties,
ccache is called on the cmake invocation instead of clang-tidy,
which makes it inefficient.
Using the C|CXX_COMPILER_LAUNCHER properties instead fixes the issue.
See https://gitlab.kitware.com/cmake/cmake/merge_requests/1791.
I moved the ccache check into src/CMakeLists.txt since it applies to
C/CXX compilation.