Don't use -Wl,--allow-shlib-undefined on macOS (#18683)

This commit is contained in:
Ilya Lavrenov 2023-07-21 13:08:26 +04:00 committed by GitHub
parent e478964695
commit bbd592b530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -419,16 +419,18 @@ macro(_ov_find_onnx_frontend_dependencies)
endmacro()
function(_ov_target_no_deprecation_error)
if(NOT MSVC)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# older macOS x86_64 does not support this linker option
if(CMAKE_CROSSCOMPILING AND NOT APPLE)
set_target_properties(${ARGV} PROPERTIES
INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(flags "-diag-warning=1786")
else()
set(flags "-Wno-error=deprecated-declarations")
endif()
if(CMAKE_CROSSCOMPILING)
set_target_properties(${ARGV} PROPERTIES
INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined")
endif()
set_target_properties(${ARGV} PROPERTIES INTERFACE_COMPILE_OPTIONS ${flags})
endif()