This commit is contained in:
Andrei Astafev 2024-04-12 12:57:09 +03:00
parent 75cde136ba
commit 62ad3b66c4

View File

@ -39,12 +39,12 @@ function(myxx_analyze_pvs_studio TARGET_NAME)
set(ARG_MODE "GA:1,2,3;64:1,2;OP:1,2,3;CS:1,2;OWASP:1,2")
endif()
get_target_property(__target_sources ${TARGET_NAME} SOURCES)
foreach(__iter ${__target_sources})
string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos)
if(__pos EQUAL -1)
list(APPEND __filtered_sources ${__iter})
endif()
get_target_property(target_src ${TARGET_NAME} SOURCES)
foreach(it ${target_src})
string(FIND ${it} ${CMAKE_BINARY_DIR} pos)
if(pos EQUAL -1)
list(APPEND filtered_src ${it})
endif()
endforeach()
pvs_studio_add_target(TARGET ${TARGET_NAME}-analyze-pvs-studio
@ -56,16 +56,16 @@ function(myxx_analyze_pvs_studio TARGET_NAME)
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS}
MODE ${ARG_MODE})
get_target_property(__target_type ${TARGET_NAME} TYPE)
if(${__target_type} STREQUAL INTERFACE_LIBRARY)
set(__target_type INTERFACE)
get_target_property(target_type ${TARGET_NAME} TYPE)
if(${target_type} STREQUAL INTERFACE_LIBRARY)
set(target_type INTERFACE)
else()
set(__target_type PRIVATE)
set(target_type PRIVATE)
endif()
if(MSVC)
target_compile_options(${TARGET_NAME} BEFORE ${__target_type} /FI ${ARG_HEADER})
target_compile_options(${TARGET_NAME} BEFORE ${target_type} /FI ${ARG_HEADER})
else() # GCC/Clang
target_compile_options(${TARGET_NAME} BEFORE ${__target_type} -include ${ARG_HEADER})
target_compile_options(${TARGET_NAME} BEFORE ${target_type} -include ${ARG_HEADER})
endif()
add_dependencies(${TARGET_NAME}-analyze-pvs-studio ${TARGET_NAME})