Skip to content

Commit 341de8d

Browse files
Use find_library to find clang on linux (openvinotoolkit#27040)
### Details: **Problem:** When a project includes both OpenVINO (via the OpenVINO developer package) and LLVM as an in-tree dependency, it can lead to conflicts between different versions of LLVM. **Solution:** * One way to resolve this is by including clang directly using `find_library`, rather than relying on `find_package`. * This approach avoids the implicit call to `find_package(LLVM)` that occurs when using `find_package(CLANG)`, thus preventing version conflicts. ### Tickets: - E-78260 --------- Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
1 parent 3ff0943 commit 341de8d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ if(ENABLE_NCC_STYLE)
8080
set(CMAKE_FIND_LIBRARY_PREFIXES ${_old_CMAKE_FIND_LIBRARY_PREFIXES})
8181
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_old_CMAKE_FIND_LIBRARY_SUFFIXES})
8282
else()
83-
find_host_package(Clang QUIET)
84-
endif()
85-
86-
if(Clang_FOUND AND TARGET libclang)
87-
get_target_property(libclang_location libclang LOCATION)
83+
find_host_library(libclang_location
84+
NAMES clang libclang libclang-${clang_version} libclang-${clang_version}.so libclang-${clang_version}.so.1
85+
PATHS /usr/lib /usr/local/lib /usr/lib/llvm-${clang_version}/lib /usr/lib/x86_64-linux-gnu
86+
NO_DEFAULT_PATH
87+
NO_CMAKE_FIND_ROOT_PATH)
8888
endif()
8989

9090
if(NOT libclang_location)

0 commit comments

Comments
 (0)