PVS Studio требует для работы CMAKE_EXPORT_COMPILE_COMMANDS

This commit is contained in:
Andrei Astafev 2019-06-26 11:46:53 +03:00
parent d9fde68239
commit bee451685f

View File

@ -1,18 +1,22 @@
function(add_pvs_check) function(add_pvs_check)
list(GET ARGN 0 _target) list(GET ARGN 0 _target)
include(PVS-Studio) if (CMAKE_EXPORT_COMPILE_COMMANDS)
find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer) include(PVS-Studio)
if(PVS_STUDIO_ANALYZER_EXE) find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer)
pvs_studio_add_target(TARGET pvs-check-${_target} if(PVS_STUDIO_ANALYZER_EXE)
DEPENDS ${_target} pvs_studio_add_target(TARGET pvs-check-${_target}
COMPILE_COMMANDS DEPENDS ${_target}
HIDE_HELP COMPILE_COMMANDS
OUTPUT FORMAT errorfile HIDE_HELP
CFG_TEXT "analysis-mode=29" OUTPUT FORMAT errorfile
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2) CFG_TEXT "analysis-mode=29"
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
else()
message(WARNING "PVS-Studio is not found")
endif()
else() else()
message(WARNING "PVS-Studio is not found") message(WARNING "Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
endif() endif()
endfunction() endfunction()