2019-06-15 13:16:27 +00:00
|
|
|
function(add_clazy_check)
|
|
|
|
list(GET ARGN 0 _target)
|
|
|
|
set(_sources ${ARGN})
|
|
|
|
list(REMOVE_AT _sources 0)
|
|
|
|
|
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-06-25 12:01:57 +00:00
|
|
|
add_custom_target(clazy-check-${_target}
|
2019-10-07 10:52:50 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
COMMAND ${CLAZY_EXE}
|
|
|
|
-checks=level2
|
|
|
|
-extra-arg="-Wno-unknown-warning-option"
|
|
|
|
-p
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
${_sources})
|
2019-06-25 12:01:57 +00:00
|
|
|
add_dependencies(clazy-check-${_target} ${_target})
|
2019-06-27 02:18:29 +00:00
|
|
|
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()
|