From b176158f69af5315181ae95dd3106339455138b9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 30 Mar 2026 22:06:07 +0000 Subject: [PATCH] Scope clang-tidy to only project root source files Disable CMAKE_CXX_CLANG_TIDY before FetchContent_MakeAvailable for googletest and google_benchmark, then restore it afterward. This ensures clang-tidy only runs on our own source code and not on third-party dependencies. Closes #39 https://claude.ai/code/session_013uCeZ4imd8797XyofRvkW4 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e66d252..f95f828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,12 @@ if(XYZ_PROTOCOL_IS_NOT_SUBPROJECT) CACHE BOOL "" FORCE) set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE) + # Disable clang-tidy for third-party dependencies so it only runs on our + # own source code (which lives directly at the project root). + set(_SAVED_CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY}") + set(CMAKE_CXX_CLANG_TIDY "") FetchContent_MakeAvailable(googletest google_benchmark) + set(CMAKE_CXX_CLANG_TIDY "${_SAVED_CMAKE_CXX_CLANG_TIDY}") enable_testing()