Skip to content

Commit 1d5cb52

Browse files
committed
feat: add support for clang-tidy-cache
1 parent f64c42b commit 1d5cb52

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/StaticAnalyzers.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ macro(enable_cppcheck)
2727
endmacro()
2828

2929
macro(enable_clang_tidy)
30-
find_program(CLANGTIDY clang-tidy)
30+
# https://github.com/ejfitzgerald/clang-tidy-cache
31+
find_program(
32+
CLANGTIDY_CACHE
33+
NAMES "clang-tidy-cache"
34+
"clang-tidy-cache-windows-amd64"
35+
"clang-tidy-cache-linux-amd64"
36+
"clang-tidy-cache-darwin-amd64")
37+
if(CLANGTIDY_CACHE)
38+
# use clang-tidy-cache if found
39+
set($ENV{CLANG_TIDY_CACHE_BINARY} ${CLANGTIDY_CACHE})
40+
set(CLANGTIDY ${CLANGTIDY_CACHE})
41+
else()
42+
# otherwise use clang-tidy directly
43+
find_program(CLANGTIDY clang-tidy)
44+
endif()
3145
if(CLANGTIDY)
3246
if(NOT
3347
CMAKE_CXX_COMPILER_ID

0 commit comments

Comments
 (0)