1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-09 12:06:07 +00:00

Add clang-tidy to CMakeLists.txt -- run it at compile time if it is found at cmake configuration time

This commit is contained in:
Nick Briggs
2021-08-29 13:39:07 -07:00
parent e957e331c4
commit dbbb59b30b

View File

@@ -16,6 +16,19 @@ IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF()
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy" "clang-tidy12" "clang-tidy11" "clang-tidy10"
DOC "Path to clang-tidy executable"
)
IF (CLANG_TIDY_EXE)
# There are many many warnings for strcpy instances to deal with,
# but suppress it for now so that other issues are more obvious
#
SET(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} -checks=-*,cert-*,clang-analyzer-security.*,-clang-analyzer-security.insecureAPI.strcpy -header-filter=.*)
ENDIF()
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m fmod "" NEED_LIB_M)
IF(NEED_LIB_M)