From 1d5cb52b8da41dc2609b93e9b7320e306453e643 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Feb 2022 14:00:20 -0800 Subject: [PATCH] feat: add support for clang-tidy-cache --- src/StaticAnalyzers.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/StaticAnalyzers.cmake b/src/StaticAnalyzers.cmake index 08320c7c..ba550a0f 100644 --- a/src/StaticAnalyzers.cmake +++ b/src/StaticAnalyzers.cmake @@ -27,7 +27,21 @@ macro(enable_cppcheck) endmacro() macro(enable_clang_tidy) - find_program(CLANGTIDY clang-tidy) + # https://github.com/ejfitzgerald/clang-tidy-cache + find_program( + CLANGTIDY_CACHE + NAMES "clang-tidy-cache" + "clang-tidy-cache-windows-amd64" + "clang-tidy-cache-linux-amd64" + "clang-tidy-cache-darwin-amd64") + if(CLANGTIDY_CACHE) + # use clang-tidy-cache if found + set($ENV{CLANG_TIDY_CACHE_BINARY} ${CLANGTIDY_CACHE}) + set(CLANGTIDY ${CLANGTIDY_CACHE}) + else() + # otherwise use clang-tidy directly + find_program(CLANGTIDY clang-tidy) + endif() if(CLANGTIDY) if(NOT CMAKE_CXX_COMPILER_ID