27 lines
881 B
CMake
27 lines
881 B
CMake
set(clazy_checks
|
|
container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast
|
|
)
|
|
|
|
function(add_clazy_check)
|
|
list(GET ARGN 0 _target)
|
|
set(_sources ${ARGN})
|
|
list(REMOVE_AT _sources 0)
|
|
|
|
find_program(CLAZY_EXE NAMES clazy-standalone)
|
|
if(CLAZY_EXE)
|
|
if(NOT TARGET clazy-check)
|
|
add_custom_target(clazy-check)
|
|
endif()
|
|
add_custom_target(
|
|
clazy-check-${_target}
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks}
|
|
-extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
|
|
add_dependencies(clazy-check-${_target} ${_target})
|
|
add_dependencies(clazy-check clazy-check-${_target})
|
|
else()
|
|
message(STATUS "CMLIB warning:")
|
|
message(STATUS " Clazy analyzer is not found")
|
|
endif()
|
|
endfunction()
|