function(add_clazy_check target) find_program(CLAZY_EXE NAMES clazy-standalone) set(_sources ${ARGN}) set(_clazy_checks "container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast") set(_args -checks=level2,${_clazy_checks} -extra-arg="-Wno-unknown-warning-option") 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} ${_args} -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 standalone analyzer is not found") endif() endfunction()