From 10567927a211cdea038d84a7c52a71391da41dd1 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 15 Jun 2019 17:54:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=20=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D1=8C=D1=8E=20?= =?UTF-8?q?PVS-Studio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCodeAnalysisPvsStudio.cmake | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/CMLibCodeAnalysisPvsStudio.cmake b/CMLibCodeAnalysisPvsStudio.cmake index 511dfbd..93d6cff 100644 --- a/CMLibCodeAnalysisPvsStudio.cmake +++ b/CMLibCodeAnalysisPvsStudio.cmake @@ -1,19 +1,18 @@ -option(USE_PVS_STUDIO "Use PVS-Studio for static analysis" OFF) +function(add_pvs_check) + list(GET ARGN 0 _target) -if(USE_PVS_STUDIO) include(PVS-Studio) find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer) - if(PVS_STUDIO_ANALYZER_EXE AND NOT TARGET pvs-global-checker) - pvs_studio_add_target(TARGET pvs-global-checker - ALL - RECURSIVE - HIDE_HELP - COMPILE_COMMANDS - OUTPUT FORMAT errorfile - MODE GA:1,2,3;64:1;OP:1,2;CS:1,2 - LOG target.err) + if(PVS_STUDIO_ANALYZER_EXE) + pvs_studio_add_target(TARGET pvs-check + DEPENDS ${_target} + COMPILE_COMMANDS + HIDE_HELP + OUTPUT FORMAT errorfile + 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() -endif() +endfunction()