From 898ec9f2fb6028057afc0b6368876610f74d1210 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 22 Feb 2026 14:13:21 +0100 Subject: [PATCH] cmake: limit clang-tidy to the shared libcurl if static is also built On platforms that require building static and shared libcurl separately, after this change clang-tidy is only run on one of them, to reduce build time by avoiding the double-work. From a clang-tidy standpoint, static and shared libs are identical. Except `dllmain.c` on Windows, which is only present in shared. To keep running it through clang-tidy, prefer the shared library for clang-tidy. Closes #20675 --- lib/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 174f3b7450..8d8215de94 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -167,6 +167,9 @@ if(BUILD_STATIC_LIBS) set_target_properties(${LIB_STATIC} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() endif() + if(CURL_CLANG_TIDY AND BUILD_SHARED_LIBS) # disable clang-tidy for static, and limit to the shared library, if both enabled + set_target_properties(${LIB_STATIC} PROPERTIES C_CLANG_TIDY "") + endif() if(CURL_CODE_COVERAGE) set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS}) set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_OPTIONS ${CURL_COVERAGE_CFLAGS})