Skip to content

Commit cb2ca23

Browse files
authored
[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
This reverts the changes from 91a3846 for Windows targets. The changes in that commit don't work as expected for Windows targets (those parts of llvm_add_library don't quite behave the same for Windows), while the previous status quo (producing a library named "libLLVM-<major>.dll") is the defacto standard way of doing versioned library names there, contrary to on Unix. After that commit, the library always ended up named "libLLVM.dll", executables linking against it would reference "libLLVM.dll", and "libLLVM-<major>.dll" was provided as a symlink. Thus revert this bit back to as it were, so that executables actually link against a versioned libLLVM, and no separate symlink is needed. The only thing that might be improved compared to the status quo as it was before these changes, is that the import library is named "lib/libLLVM-<major>.dll.a", while the common style would be to name it plainly "lib/libLLVM.dll.a" (even while it produces references to "libLLVM-<major>.dll", but none of these had that effect for Windows targets. (As a side note, the llvm-shlib library can be built for MinGW, but not currently in MSVC configurations.)
1 parent b1752dd commit cb2ca23

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/tools/llvm-shlib/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ if(LLVM_BUILD_LLVM_DYLIB)
3333
if (LLVM_LINK_LLVM_DYLIB)
3434
set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
3535
endif()
36-
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB OUTPUT_NAME LLVM ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
37-
# Add symlink for backwards compatibility with old library name
38-
llvm_install_library_symlink(LLVM-${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX} $<TARGET_FILE_NAME:LLVM> SHARED FULL_DEST COMPONENT LLVM)
36+
if (WIN32)
37+
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
38+
else()
39+
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB OUTPUT_NAME LLVM ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
40+
# Add symlink for backwards compatibility with old library name
41+
llvm_install_library_symlink(LLVM-${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX} $<TARGET_FILE_NAME:LLVM> SHARED FULL_DEST COMPONENT LLVM)
42+
endif()
3943

4044
list(REMOVE_DUPLICATES LIB_NAMES)
4145
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

0 commit comments

Comments
 (0)