Skip to content

Commit 234e819

Browse files
author
Cristian Le
committed
Extract libclang_lib_dir more reliably
Change-Id: I207fd29cb0aa40a25828b6b4687a6274b52e8ffa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
1 parent 94f42a7 commit 234e819

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

sources/shiboken6/cmake/ShibokenHelpers.cmake

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -869,28 +869,9 @@ endfunction()
869869

870870
# Get path to libclang.dll/libclang.so depending on the platform
871871
macro(find_libclang)
872-
if(CMAKE_HOST_WIN32)
873-
set(libclang_directory_suffix "bin")
874-
set(libclang_suffix ".dll")
875-
else()
876-
set(libclang_directory_suffix "lib")
877-
if(CMAKE_HOST_APPLE)
878-
set(libclang_suffix ".dylib")
879-
else()
880-
set(libclang_suffix ".so")
881-
endif()
882-
endif()
883-
884-
set(libclang_lib_dir "")
885-
if(DEFINED ENV{LLVM_INSTALL_DIR})
886-
set(libclang_lib_dir "$ENV{LLVM_INSTALL_DIR}/${libclang_directory_suffix}")
887-
elseif(DEFINED ENV{CLANG_INSTALL_DIR})
888-
set(libclang_lib_dir "$ENV{CLANG_INSTALL_DIR}/${libclang_directory_suffix}")
889-
else()
890-
message(WARNING
891-
"Couldn't find libclang${libclang_suffix} "
892-
"You will likely need to add it manually to PATH to ensure the build succeeds.")
893-
endif()
872+
find_package(Clang CONFIG REQUIRED)
873+
get_target_property(libclang_location libclang LOCATION)
874+
get_filename_component(libclang_lib_dir "${libclang_location}" DIRECTORY)
894875
endmacro()
895876

896877
# Allow setting a shiboken debug level from the the build system or from the environment

0 commit comments

Comments
 (0)