[CMAKE] Make ccache to work with clang-tidy
Summary:
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.
Test Plan:
With ccache enabled:
ninja
Delete you build directory, then run again:
ninja
Check the build performance increased thanks to ccache.
Reviewers: #bitcoin_abc, markblundeberg
Reviewed By: #bitcoin_abc, markblundeberg
Differential Revision: https://reviews.bitcoinabc.org/D5150