Skip to content

Commit 68ac4ff

Browse files
committed
feat: add support for clang-tidy-cache
1 parent 8195bdf commit 68ac4ff

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
@@ -23,7 +23,21 @@ macro(enable_cppcheck)
2323
endmacro()
2424

2525
macro(enable_clang_tidy)
26-
find_program(CLANGTIDY clang-tidy)
26+
# https://github.com/ejfitzgerald/clang-tidy-cache
27+
find_program(
28+
CLANGTIDY_CACHE
29+
NAMES "clang-tidy-cache"
30+
"clang-tidy-cache-windows-amd64"
31+
"clang-tidy-cache-linux-amd64"
32+
"clang-tidy-cache-darwin-amd64")
33+
if(CLANGTIDY_CACHE)
34+
# use clang-tidy-cache if found
35+
set($ENV{CLANG_TIDY_CACHE_BINARY} ${CLANGTIDY_CACHE})
36+
set(CLANGTIDY ${CLANGTIDY_CACHE})
37+
else()
38+
# otherwise use clang-tidy directly
39+
find_program(CLANGTIDY clang-tidy)
40+
endif()
2741
if(CLANGTIDY)
2842
if(NOT
2943
CMAKE_CXX_COMPILER_ID

0 commit comments

Comments
 (0)