This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/566-introduce-clang-tidy-setup in repository https://gitbox.apache.org/repos/asf/celix.git
commit bff4a91810df5fa4d362203b42579572ef21bab5 Merge: 3612b3644 a0562f81d Author: Pepijn Noltes <[email protected]> AuthorDate: Tue Feb 10 18:43:34 2026 +0100 Merge remote-tracking branch 'origin/master' into feature/566-introduce-clang-tidy-setup cmake/celix_project/CelixProject.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --cc cmake/celix_project/CelixProject.cmake index e3ebc7cc4,bd7e7f29d..221416fde --- a/cmake/celix_project/CelixProject.cmake +++ b/cmake/celix_project/CelixProject.cmake @@@ -78,45 -73,35 +78,45 @@@ elseif (ENABLE_THREAD_SANITIZER set(CMAKE_CXX_FLAGS "-fsanitize=thread ${CMAKE_CXX_FLAGS}") endif() -if (ENABLE_GCC_ANALYZER) - if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - set(ANALYZER_FLAGS - "-fanalyzer" - "-Wno-analyzer-too-complex" - "-Wno-analyzer-double-fclose" +if (ENABLE_CLANG_TIDY) + find_program(CLANG_TIDY_EXE NAMES clang-tidy) + if (CLANG_TIDY_EXE) + set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE}) + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE}) + else() + message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON, but clang-tidy was not found.") + endif() +endif () + +if (ENABLE_GCC_ANALYZER) + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + set(ANALYZER_FLAGS + "-fanalyzer" + "-Wno-analyzer-too-complex" + "-Wno-analyzer-double-fclose" "-Wno-analyzer-double-free" - "-Wno-analyzer-deref-before-check" - "-Wno-analyzer-exposure-through-output-file" - "-Wno-analyzer-file-leak" - "-Wno-analyzer-free-of-non-heap" - "-Wno-analyzer-malloc-leak" - "-Wno-analyzer-possible-null-argument" - "-Wno-analyzer-possible-null-dereference" - "-Wno-analyzer-null-argument" - "-Wno-analyzer-null-dereference" - "-Wno-analyzer-stale-setjmp-buffer" - "-Wno-analyzer-tainted-array-index" - "-Wno-analyzer-unsafe-call-within-signal-handler" - "-Wno-analyzer-use-after-free" + "-Wno-analyzer-deref-before-check" + "-Wno-analyzer-exposure-through-output-file" + "-Wno-analyzer-file-leak" + "-Wno-analyzer-free-of-non-heap" + "-Wno-analyzer-malloc-leak" + "-Wno-analyzer-possible-null-argument" + "-Wno-analyzer-possible-null-dereference" + "-Wno-analyzer-null-argument" + "-Wno-analyzer-null-dereference" + "-Wno-analyzer-stale-setjmp-buffer" + "-Wno-analyzer-tainted-array-index" + "-Wno-analyzer-unsafe-call-within-signal-handler" + "-Wno-analyzer-use-after-free" "-Wno-analyzer-use-of-pointer-in-stale-stack-frame" - "-Wno-analyzer-use-of-uninitialized-value" - "-Wno-analyzer-fd-leak" + "-Wno-analyzer-use-of-uninitialized-value" + "-Wno-analyzer-fd-leak" "-Wno-analyzer-shift-count-negative" - ) - add_compile_options(${ANALYZER_FLAGS}) + ) + add_compile_options("$<$<COMPILE_LANGUAGE:C>:${ANALYZER_FLAGS}>") else() - message(WARNING "ENABLE_GCC_ANALYZER is only supported with GCC ") - endif() + message(WARNING "ENABLE_GCC_ANALYZER is only supported with GCC ") + endif() endif()
