2019-12-03 16:23:14 +00:00
|
|
|
set(clazy_checks
|
|
|
|
container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast
|
|
|
|
)
|
2019-10-16 16:18:32 +00:00
|
|
|
|
2020-04-13 16:44:42 +00:00
|
|
|
function(add_clazy_check target)
|
2019-06-15 13:16:27 +00:00
|
|
|
set(_sources ${ARGN})
|
|
|
|
|
2019-10-07 10:52:50 +00:00
|
|
|
find_program(CLAZY_EXE NAMES clazy-standalone)
|
2019-06-15 13:16:27 +00:00
|
|
|
if(CLAZY_EXE)
|
2019-06-27 02:18:29 +00:00
|
|
|
if(NOT TARGET clazy-check)
|
|
|
|
add_custom_target(clazy-check)
|
|
|
|
endif()
|
2019-12-03 16:23:14 +00:00
|
|
|
add_custom_target(
|
2020-04-13 16:44:42 +00:00
|
|
|
clazy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2020-04-01 18:42:59 +00:00
|
|
|
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks} -extra-arg="-Wno-unknown-warning-option" -p
|
|
|
|
${CMAKE_BINARY_DIR} ${_sources})
|
2020-04-13 16:44:42 +00:00
|
|
|
add_dependencies(clazy-check-${target} ${target})
|
|
|
|
add_dependencies(clazy-check clazy-check-${target})
|
2019-06-15 13:16:27 +00:00
|
|
|
else()
|
2019-08-10 07:30:01 +00:00
|
|
|
message(STATUS "CMLIB warning:")
|
|
|
|
message(STATUS " Clazy analyzer is not found")
|
2019-06-15 13:16:27 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|