Установка флагов в зависимости от типа цели

This commit is contained in:
Andrei Astafev 2020-10-02 11:31:18 +03:00
parent eeae991b4c
commit 67cbb07e51
2 changed files with 8 additions and 3 deletions

View File

@ -16,10 +16,16 @@ function(add_pvs_check target)
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2) MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
add_dependencies(pvs-check pvs-check-${target}) add_dependencies(pvs-check pvs-check-${target})
configure_file("${CMLIB_MODULE_DIR}/hpp/pvs_studio.hpp.in" "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp") configure_file("${CMLIB_MODULE_DIR}/hpp/pvs_studio.hpp.in" "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
get_target_property(target_type ${target} TYPE)
if (${target_type} STREQUAL "INTERFACE_LIBRARY")
set(target_type INTERFACE)
else()
set(target_type PRIVATE)
endif()
if(MSVC) if(MSVC)
target_compile_options(${target} PUBLIC /FI "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp") target_compile_options(${target} ${target_type} /FI "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
else() # GCC/Clang else() # GCC/Clang
target_compile_options(${target} PUBLIC -include "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp") target_compile_options(${target} ${target_type} -include "${CMAKE_BINARY_DIR}/include/pvs_studio.hpp")
endif() endif()
else() else()
message(STATUS "CMLIB warning:") message(STATUS "CMLIB warning:")

View File

@ -3,7 +3,6 @@
#pragma once #pragma once
//-V::801
//-V813_MINSIZE=33 //-V813_MINSIZE=33
#endif // PVS_STUDIO_HPP_ #endif // PVS_STUDIO_HPP_