cmlib/CMLibCodeAnalysisClazy.cmake

23 lines
708 B
CMake

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 -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()