mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Avoid linking LLVM component libraries with libLLVM
Patch by Jack Howarth. When linking to libLLVM, don't also link to the component libraries that constitute libLLVM. Differential Revision: http://reviews.llvm.org/D16945 llvm-svn: 260641
This commit is contained in:
parent
075e6aecf1
commit
fb2090fa73
@ -468,20 +468,23 @@ function(llvm_add_library name)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add the explicit dependency information for this library.
|
if (DEFINED LLVM_LINK_COMPONENTS OR DEFINED ARG_LINK_COMPONENTS)
|
||||||
#
|
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
|
||||||
# It would be nice to verify that we have the dependencies for this library
|
set(llvm_libs LLVM)
|
||||||
# name, but using get_property(... SET) doesn't suffice to determine if a
|
else()
|
||||||
# property has been set to an empty value.
|
llvm_map_components_to_libnames(llvm_libs
|
||||||
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
|
${ARG_LINK_COMPONENTS}
|
||||||
|
${LLVM_LINK_COMPONENTS}
|
||||||
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_STATIC AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
|
)
|
||||||
set(llvm_libs LLVM)
|
endif()
|
||||||
else()
|
else()
|
||||||
llvm_map_components_to_libnames(llvm_libs
|
# Components have not been defined explicitly in CMake, so add the
|
||||||
${ARG_LINK_COMPONENTS}
|
# dependency information for this library as defined by LLVMBuild.
|
||||||
${LLVM_LINK_COMPONENTS}
|
#
|
||||||
)
|
# It would be nice to verify that we have the dependencies for this library
|
||||||
|
# name, but using get_property(... SET) doesn't suffice to determine if a
|
||||||
|
# property has been set to an empty value.
|
||||||
|
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||||
@ -882,14 +885,11 @@ function(add_unittest test_suite test_name)
|
|||||||
|
|
||||||
set(LLVM_REQUIRES_RTTI OFF)
|
set(LLVM_REQUIRES_RTTI OFF)
|
||||||
|
|
||||||
|
list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
|
||||||
add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO ${ARGN})
|
add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO ${ARGN})
|
||||||
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
|
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
|
||||||
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
|
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
|
||||||
target_link_libraries(${test_name}
|
target_link_libraries(${test_name} gtest_main gtest)
|
||||||
gtest
|
|
||||||
gtest_main
|
|
||||||
LLVMSupport # gtest needs it for raw_ostream.
|
|
||||||
)
|
|
||||||
|
|
||||||
add_dependencies(${test_suite} ${test_name})
|
add_dependencies(${test_suite} ${test_name})
|
||||||
get_target_property(test_suite_folder ${test_suite} FOLDER)
|
get_target_property(test_suite_folder ${test_suite} FOLDER)
|
||||||
|
@ -40,10 +40,19 @@ macro(llvm_config executable)
|
|||||||
# done in case libLLVM does not contain all of the components
|
# done in case libLLVM does not contain all of the components
|
||||||
# the target requires.
|
# the target requires.
|
||||||
#
|
#
|
||||||
# TODO strip LLVM_DYLIB_COMPONENTS out of link_components.
|
# Strip LLVM_DYLIB_COMPONENTS out of link_components.
|
||||||
# To do this, we need special handling for "all", since that
|
# To do this, we need special handling for "all", since that
|
||||||
# may imply linking to libraries that are not included in
|
# may imply linking to libraries that are not included in
|
||||||
# libLLVM.
|
# libLLVM.
|
||||||
|
|
||||||
|
if (DEFINED link_components AND DEFINED LLVM_DYLIB_COMPONENTS)
|
||||||
|
if("${LLVM_DYLIB_COMPONENTS}" STREQUAL "all")
|
||||||
|
set(link_components "")
|
||||||
|
else()
|
||||||
|
list(REMOVE_ITEM link_components ${LLVM_DYLIB_COMPONENTS})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${executable} LLVM)
|
target_link_libraries(${executable} LLVM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -32,10 +32,6 @@ if (NOT LLVM_ENABLE_THREADS)
|
|||||||
add_definitions( -DGTEST_HAS_PTHREAD=0 )
|
add_definitions( -DGTEST_HAS_PTHREAD=0 )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBS
|
|
||||||
LLVMSupport # Depends on llvm::raw_ostream
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(PTHREAD_LIBRARY_PATH pthread)
|
find_library(PTHREAD_LIBRARY_PATH pthread)
|
||||||
if (PTHREAD_LIBRARY_PATH)
|
if (PTHREAD_LIBRARY_PATH)
|
||||||
list(APPEND LIBS pthread)
|
list(APPEND LIBS pthread)
|
||||||
@ -46,6 +42,9 @@ add_llvm_library(gtest
|
|||||||
|
|
||||||
LINK_LIBS
|
LINK_LIBS
|
||||||
${LIBS}
|
${LIBS}
|
||||||
|
|
||||||
|
LINK_COMPONENTS
|
||||||
|
Support # Depends on llvm::raw_ostream
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(UnitTestMain)
|
add_subdirectory(UnitTestMain)
|
||||||
|
@ -3,5 +3,7 @@ add_llvm_library(gtest_main
|
|||||||
|
|
||||||
LINK_LIBS
|
LINK_LIBS
|
||||||
gtest
|
gtest
|
||||||
LLVMSupport # Depends on llvm::cl
|
|
||||||
|
LINK_COMPONENTS
|
||||||
|
Support # Depends on llvm::cl
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user