Skip to content

Commit d2ab797

Browse files
Fixed compilation with clang and libc++ (#25813)
### Details: - *item1* - *...* ### Tickets: - Closes #25420
1 parent b26c533 commit d2ab797

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ endif()
9292
if(NOT OV_LIBC_VERSION VERSION_EQUAL 0.0)
9393
message (STATUS "LIBC_VERSION .......................... " ${OV_LIBC_VERSION})
9494
endif()
95+
if(DEFINED OPENVINO_STDLIB)
96+
message (STATUS "STDLIB ................................ " ${OPENVINO_STDLIB})
97+
endif()
9598

9699
# remove file with exported targets to force its regeneration
97100
file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")

cmake/developer_package/target_flags.cmake

+20-3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,23 @@ get_property(OV_GENERATOR_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG
119119

120120
function(ov_detect_libc_type)
121121
include(CheckCXXSourceCompiles)
122+
check_cxx_source_compiles("
123+
# include <string>
124+
# ifndef _GLIBCXX_USE_CXX11_ABI
125+
# error \"GlibCXX ABI is not defined\"
126+
# endif
127+
128+
int main() {
129+
return 0;
130+
}"
131+
OPENVINO_STDLIB_GNU)
132+
133+
if(OPENVINO_STDLIB_GNU)
134+
set(OPENVINO_STDLIB "GNU" PARENT_SCOPE)
135+
else()
136+
set(OPENVINO_STDLIB "CPP" PARENT_SCOPE)
137+
endif()
138+
122139
check_cxx_source_compiles("
123140
# ifndef _GNU_SOURCE
124141
# define _GNU_SOURCE
@@ -140,9 +157,9 @@ function(ov_detect_libc_type)
140157
int main() {
141158
return 0;
142159
}"
143-
OPENVINO_MUSL_LIBC)
160+
OPENVINO_GLIBC_MUSL)
144161

145-
if(OPENVINO_MUSL_LIBC)
162+
if(OPENVINO_GLIBC_MUSL)
146163
set(OPENVINO_MUSL_LIBC ON PARENT_SCOPE)
147164
else()
148165
set(OPENVINO_GNU_LIBC ON PARENT_SCOPE)
@@ -213,7 +230,7 @@ ov_libc_version()
213230
# Detects default value for _GLIBCXX_USE_CXX11_ABI for current compiler
214231
#
215232
macro(ov_get_glibcxx_use_cxx11_abi)
216-
if(LINUX)
233+
if(LINUX AND OPENVINO_STDLIB STREQUAL "GNU")
217234
ov_get_compiler_definition("_GLIBCXX_USE_CXX11_ABI" OV_GLIBCXX_USE_CXX11_ABI)
218235
endif()
219236
endmacro()

0 commit comments

Comments
 (0)