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

View File

@ -39,11 +39,11 @@ 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") set(ARG_MODE "GA:1,2,3;64:1,2;OP:1,2,3;CS:1,2;OWASP:1,2")
endif() endif()
get_target_property(__target_sources ${TARGET_NAME} SOURCES) get_target_property(target_src ${TARGET_NAME} SOURCES)
foreach(__iter ${__target_sources}) foreach(it ${target_src})
string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos) string(FIND ${it} ${CMAKE_BINARY_DIR} pos)
if(__pos EQUAL -1) if(pos EQUAL -1)
list(APPEND __filtered_sources ${__iter}) list(APPEND filtered_src ${it})
endif() endif()
endforeach() endforeach()
@ -56,16 +56,16 @@ function(myxx_analyze_pvs_studio TARGET_NAME)
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS} ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS}
MODE ${ARG_MODE}) MODE ${ARG_MODE})
get_target_property(__target_type ${TARGET_NAME} TYPE) get_target_property(target_type ${TARGET_NAME} TYPE)
if(${__target_type} STREQUAL INTERFACE_LIBRARY) if(${target_type} STREQUAL INTERFACE_LIBRARY)
set(__target_type INTERFACE) set(target_type INTERFACE)
else() else()
set(__target_type PRIVATE) set(target_type PRIVATE)
endif() endif()
if(MSVC) 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 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() endif()
add_dependencies(${TARGET_NAME}-analyze-pvs-studio ${TARGET_NAME}) add_dependencies(${TARGET_NAME}-analyze-pvs-studio ${TARGET_NAME})