]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
build: add ENABLE_CLANG_TIDY and CLANG_TIDY_PATH
authorDustin L. Howett <dustin@howett.net>
Tue, 30 Jun 2026 14:43:53 +0000 (09:43 -0500)
committerDustin L. Howett <dustin@howett.net>
Sat, 4 Jul 2026 19:42:26 +0000 (14:42 -0500)
CMakeLists.txt

index da8ffa711e12fa70c58781fd847a077c82dc0984..fa94a6c002e5d1e692374ac6da3f15468cc90ae0 100644 (file)
@@ -254,6 +254,7 @@ OPTION(ENABLE_ICONV "Enable iconv support" ON)
 OPTION(ENABLE_TEST "Enable unit and regression tests" ON)
 OPTION(ENABLE_COVERAGE "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)" FALSE)
 OPTION(ENABLE_INSTALL "Enable installing of libraries" ON)
+OPTION(ENABLE_CLANG_TIDY "Enable custom build-time code health checks" OFF)
 
 IF(WIN32 AND MSVC)
   OPTION(MSVC_USE_STATIC_CRT "Use static CRT" OFF)
@@ -2229,6 +2230,13 @@ IF(ENABLE_TEST)
   ADD_CUSTOM_TARGET(run_all_tests)
 ENDIF(ENABLE_TEST)
 
+IF(ENABLE_CLANG_TIDY)
+  IF(NOT CLANG_TIDY_PATH)
+    SET(CLANG_TIDY_PATH clang-tidy)
+  ENDIF(NOT CLANG_TIDY_PATH)
+  SET(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_PATH})
+ENDIF(ENABLE_CLANG_TIDY)
+
 add_subdirectory(libarchive)
 add_subdirectory(cat)
 add_subdirectory(tar)