Skip to content

Commit 1124f46

Browse files
committed
feat: add support for clang-tidy-cache
1 parent 2fb47e4 commit 1124f46

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/StaticAnalyzers.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,21 @@ endmacro()
5555

5656
# Enable static analysis with clang-tidy
5757
macro(enable_clang_tidy)
58-
find_program(CLANGTIDY clang-tidy)
58+
# https://github.com/ejfitzgerald/clang-tidy-cache
59+
find_program(
60+
CLANGTIDY_CACHE
61+
NAMES "clang-tidy-cache"
62+
"clang-tidy-cache-windows-amd64"
63+
"clang-tidy-cache-linux-amd64"
64+
"clang-tidy-cache-darwin-amd64")
65+
if(CLANGTIDY_CACHE)
66+
# use clang-tidy-cache if found
67+
set($ENV{CLANG_TIDY_CACHE_BINARY} ${CLANGTIDY_CACHE})
68+
set(CLANGTIDY ${CLANGTIDY_CACHE})
69+
else()
70+
# otherwise use clang-tidy directly
71+
find_program(CLANGTIDY clang-tidy)
72+
endif()
5973
if(CLANGTIDY)
6074

6175
# clang-tidy only works with clang when PCH is enabled

0 commit comments

Comments
 (0)