32 lines
1.0 KiB
CMake
32 lines
1.0 KiB
CMake
function(add_pvs_check)
|
|
list(GET ARGN 0 _target)
|
|
|
|
if(CMAKE_EXPORT_COMPILE_COMMANDS)
|
|
include(PVS-Studio)
|
|
find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer)
|
|
if(PVS_STUDIO_ANALYZER_EXE)
|
|
if(NOT TARGET pvs-check)
|
|
add_custom_target(pvs-check)
|
|
endif()
|
|
pvs_studio_add_target(
|
|
TARGET pvs-check-${_target}
|
|
DEPENDS ${_target}
|
|
COMPILE_COMMANDS HIDE_HELP OUTPUT
|
|
FORMAT errorfile
|
|
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
|
|
ARGS --analysis-mode 29 --exclude-path
|
|
${CMAKE_CURRENT_BINARY_DIR}/${_target}_autogen
|
|
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
|
|
add_dependencies(pvs-check pvs-check-${_target})
|
|
else()
|
|
message(STATUS "CMLIB warning:")
|
|
message(STATUS " PVS-Studio analyzer is not found")
|
|
endif()
|
|
else()
|
|
message(STATUS "CMLIB warning:")
|
|
message(
|
|
STATUS
|
|
" Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
|
|
endif()
|
|
endfunction()
|