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,6 +1,7 @@
function(add_pvs_check) function(add_pvs_check)
list(GET ARGN 0 _target) list(GET ARGN 0 _target)
if (CMAKE_EXPORT_COMPILE_COMMANDS)
include(PVS-Studio) include(PVS-Studio)
find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer) find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer)
if(PVS_STUDIO_ANALYZER_EXE) if(PVS_STUDIO_ANALYZER_EXE)
@ -14,5 +15,8 @@ function(add_pvs_check)
else() else()
message(WARNING "PVS-Studio is not found") message(WARNING "PVS-Studio is not found")
endif() endif()
else()
message(WARNING "Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
endif()
endfunction() endfunction()