mirror of
https://github.com/triqs/dft_tools
synced 2024-09-16 17:35:31 +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 ==========
|
# ========= Static Analyzer Checks ==========
|
||||||
|
|
||||||
# Locate static analyzer tools
|
option(ANALYZE_SOURCES OFF "Run static analyzer checks if found (clang-tidy, cppcheck)")
|
||||||
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
|
if(ANALYZE_SOURCES)
|
||||||
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
|
|
||||||
|
|
||||||
# Run clang-tidy if found
|
# Locate static analyzer tools
|
||||||
if(CLANG_TIDY_EXECUTABLE)
|
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
|
||||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
|
||||||
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
|
# Run clang-tidy if found
|
||||||
if(CPPCHECK_EXECUTABLE)
|
if(CLANG_TIDY_EXECUTABLE)
|
||||||
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
|
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
||||||
add_custom_command(
|
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
|
TARGET app4triqs_c
|
||||||
COMMAND ${CPPCHECK_EXECUTABLE}
|
COMMAND ${CPPCHECK_EXECUTABLE}
|
||||||
--enable=warning,style,performance,portability
|
--enable=warning,style,performance,portability
|
||||||
--std=c++14
|
--std=c++14
|
||||||
--template=gcc
|
--template=gcc
|
||||||
--verbose
|
--verbose
|
||||||
--quiet
|
--quiet
|
||||||
${sources}
|
${sources}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
|
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user