mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[CMake] LINK_LIBS need to be public for Darwin dylib targets
This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib. llvm-svn: 270723
This commit is contained in:
parent
198e5cb8a0
commit
2b1c02aa22
@ -489,25 +489,20 @@ function(llvm_add_library name)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
# Link libs w/o keywords, assuming PUBLIC.
|
||||
target_link_libraries(${name}
|
||||
${ARG_LINK_LIBS}
|
||||
${lib_deps}
|
||||
${llvm_libs}
|
||||
)
|
||||
set(library_type)
|
||||
elseif(ARG_STATIC)
|
||||
target_link_libraries(${name} INTERFACE
|
||||
${ARG_LINK_LIBS}
|
||||
${lib_deps}
|
||||
${llvm_libs}
|
||||
)
|
||||
set(library_type INTERFACE)
|
||||
elseif(APPLE)
|
||||
set(library_type PUBLIC)
|
||||
else()
|
||||
# We can use PRIVATE since SO knows its dependent libs.
|
||||
target_link_libraries(${name} PRIVATE
|
||||
set(library_type PRIVATE)
|
||||
endif()
|
||||
target_link_libraries(${name} ${library_type}
|
||||
${ARG_LINK_LIBS}
|
||||
${lib_deps}
|
||||
${llvm_libs}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LLVM_COMMON_DEPENDS)
|
||||
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
|
||||
|
@ -38,6 +38,17 @@ endif()
|
||||
|
||||
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
|
||||
|
||||
if(APPLE)
|
||||
set(library_type PUBLIC)
|
||||
else()
|
||||
# We can use PRIVATE since SO knows its dependent libs.
|
||||
set(library_type PRIVATE)
|
||||
endif()
|
||||
|
||||
get_property(system_libs TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
|
||||
|
||||
target_link_libraries(LLVM ${library_type} ${system_libs})
|
||||
|
||||
list(REMOVE_DUPLICATES LIB_NAMES)
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf"
|
||||
# GNU ld doesn't resolve symbols in the version script.
|
||||
|
Loading…
Reference in New Issue
Block a user