Merge pull request #12756 from guijan/fix-llvm
fix linking against LLVM shared library
This commit is contained in:
commit
57c890d4fc
|
@ -52,28 +52,22 @@ if(TARGET LibUSB::LibUSB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_LLVM)
|
if(ENABLE_LLVM)
|
||||||
find_package(LLVM CONFIG QUIET)
|
find_package(LLVM CONFIG)
|
||||||
if(LLVM_FOUND AND TARGET LLVM)
|
if(LLVM_FOUND)
|
||||||
message(STATUS "LLVM found, enabling LLVM support in disassembler")
|
message(STATUS "LLVM found, enabling LLVM support in disassembler")
|
||||||
# Minimal documentation about LLVM's CMake functions is available here:
|
# Minimal documentation about LLVM's CMake functions is available here:
|
||||||
# https://releases.llvm.org/16.0.0/docs/CMake.html#embedding-llvm-in-your-project
|
# https://releases.llvm.org/16.0.0/docs/CMake.html#embedding-llvm-in-your-project
|
||||||
|
# https://groups.google.com/g/llvm-dev/c/YeEVe7HTasQ?pli=1
|
||||||
#
|
#
|
||||||
# However, you have to read the source code in any case.
|
# However, you have to read the source code in any case.
|
||||||
# Look for LLVM-Config.cmake in your (Unix) system:
|
# Look for LLVM-Config.cmake in your (Unix) system:
|
||||||
# $ find /usr -name LLVM-Config\\.cmake 2>/dev/null
|
# $ find /usr -name LLVM-Config\\.cmake 2>/dev/null
|
||||||
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
|
|
||||||
target_compile_definitions(uicommon
|
|
||||||
PRIVATE HAVE_LLVM ${LLVM_DEFINITIONS_LIST}
|
|
||||||
)
|
|
||||||
target_link_directories(uicommon PRIVATE ${LLVM_LIBRARY_DIRS})
|
|
||||||
llvm_expand_pseudo_components(LLVM_EXPAND_COMPONENTS
|
llvm_expand_pseudo_components(LLVM_EXPAND_COMPONENTS
|
||||||
AllTargetsInfos AllTargetsDisassemblers AllTargetsCodeGens
|
AllTargetsInfos AllTargetsDisassemblers AllTargetsCodeGens
|
||||||
)
|
)
|
||||||
llvm_map_components_to_libnames(LLVM_LIBRARIES
|
llvm_config(uicommon USE_SHARED
|
||||||
mcdisassembler target ${LLVM_EXPAND_COMPONENTS}
|
mcdisassembler target ${LLVM_EXPAND_COMPONENTS}
|
||||||
)
|
)
|
||||||
target_link_libraries(uicommon PRIVATE ${LLVM_LIBRARIES})
|
|
||||||
target_include_directories(uicommon PRIVATE ${LLVM_INCLUDE_DIRS})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue