mirror of
https://github.com/triqs/dft_tools
synced 2024-06-29 00:15:00 +02:00
Make static analyzers optional
This commit is contained in:
parent
afd3ae12f2
commit
d8f6932888
|
@ -21,33 +21,38 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING
|
|||
|
||||
# ========= Static Analyzer Checks ==========
|
||||
|
||||
# Locate static analyzer tools
|
||||
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
|
||||
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
|
||||
option(ANALYZE_SOURCES OFF "Run static analyzer checks if found (clang-tidy, cppcheck)")
|
||||
if(ANALYZE_SOURCES)
|
||||
|
||||
# Run clang-tidy if found
|
||||
if(CLANG_TIDY_EXECUTABLE)
|
||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
||||
set_target_properties(app4triqs_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
||||
else()
|
||||
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
|
||||
endif()
|
||||
# Locate static analyzer tools
|
||||
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
|
||||
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
|
||||
|
||||
# Run cppcheck if found
|
||||
if(CPPCHECK_EXECUTABLE)
|
||||
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
|
||||
add_custom_command(
|
||||
# Run clang-tidy if found
|
||||
if(CLANG_TIDY_EXECUTABLE)
|
||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
||||
set_target_properties(app4triqs_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
||||
else()
|
||||
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
|
||||
endif()
|
||||
|
||||
# Run cppcheck if found
|
||||
if(CPPCHECK_EXECUTABLE)
|
||||
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
|
||||
add_custom_command(
|
||||
TARGET app4triqs_c
|
||||
COMMAND ${CPPCHECK_EXECUTABLE}
|
||||
--enable=warning,style,performance,portability
|
||||
--std=c++14
|
||||
--template=gcc
|
||||
--verbose
|
||||
--quiet
|
||||
${sources}
|
||||
)
|
||||
else()
|
||||
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
|
||||
--enable=warning,style,performance,portability
|
||||
--std=c++14
|
||||
--template=gcc
|
||||
--verbose
|
||||
--quiet
|
||||
${sources}
|
||||
)
|
||||
else()
|
||||
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user