Skip to content

Commit

Permalink
Use shared library of LLVM if available.
Browse files Browse the repository at this point in the history
- Use the singular shared library if found like in some
  LLVM distributions, instead of multiple static libraries.
  • Loading branch information
Thelta committed Sep 17, 2023
1 parent da573bc commit f80fa1c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/ObjectUtils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

cmake_minimum_required(VERSION 3.15)

find_library(LLVM_LIBS LLVM NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH PATHS ${LLVM_LIBRARY_DIR})

if(NOT LLVM_LIBS)
set(LLVM_LIBS
LLVMDebugInfoCodeView
LLVMDebugInfoDWARF
LLVMDebugInfoPDB
LLVMHeaders
LLVMObject
LLVMSymbolize)
endif()

project(ObjectUtils)
add_library(ObjectUtils STATIC)

Expand Down Expand Up @@ -55,12 +67,8 @@ target_link_libraries(
absl::synchronization
absl::time
absl::span
LLVMDebugInfoCodeView
LLVMDebugInfoDWARF
LLVMDebugInfoPDB
LLVMHeaders
LLVMObject
LLVMSymbolize)
${LLVM_LIBS}
)

if (WIN32)
target_link_libraries(ObjectUtils PUBLIC DIASDK::DIASDK)
Expand Down

0 comments on commit f80fa1c

Please sign in to comment.