Skip to content

Commit

Permalink
llvm-shlib: Fix libLLVM-${MAJOR}.so symlink on MacOS (llvm#85163)
Browse files Browse the repository at this point in the history
This is a partial revert of 10c48a7
with a fix for the symlink target name on MacOS

See llvm#84637
  • Loading branch information
tstellar committed Mar 15, 2024
1 parent 6b53ada commit ec2b752
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@ function(add_lit_testsuites project directory)
endfunction()

function(llvm_install_library_symlink name dest type)
cmake_parse_arguments(ARG "" "COMPONENT;SOVERSION" "" ${ARGN})
cmake_parse_arguments(ARG "FULL_DEST" "COMPONENT" "" ${ARGN})
foreach(path ${CMAKE_MODULE_PATH})
if(EXISTS ${path}/LLVMInstallSymlink.cmake)
set(INSTALL_SYMLINK ${path}/LLVMInstallSymlink.cmake)
Expand All @@ -2104,8 +2104,8 @@ function(llvm_install_library_symlink name dest type)
endif()

set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
if (ARG_SOVERSION)
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}.${ARG_SOVERSION})
if (ARG_FULL_DEST)
set(full_dest ${dest})
else()
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
endif()
Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/llvm-shlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
endif()
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB OUTPUT_NAME LLVM ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
# Add symlink for backwards compatibility with old library name
get_target_property(LLVM_DYLIB_SOVERSION LLVM SOVERSION)
llvm_install_library_symlink(LLVM-${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX} LLVM SHARED COMPONENT LLVM SOVERSION ${LLVM_DYLIB_SOVERSION})
llvm_install_library_symlink(LLVM-${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX} $<TARGET_SONAME_FILE_NAME:LLVM> SHARED FULL_DEST COMPONENT LLVM)

list(REMOVE_DUPLICATES LIB_NAMES)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
Expand Down

0 comments on commit ec2b752

Please sign in to comment.