diff options
author | Eric Fiselier <eric@efcs.ca> | 2014-10-19 00:42:41 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2014-10-19 00:42:41 +0000 |
commit | a63c149ceb0e68037df3b7838ed55f6724280b33 (patch) | |
tree | 66459725f6d7ee86c2cf540e9f97e310a54715a5 /libcxx/lib | |
parent | 8a99373812cfc7feb30c28ef5fb23c774856eb38 (diff) | |
download | bcm5719-llvm-a63c149ceb0e68037df3b7838ed55f6724280b33.tar.gz bcm5719-llvm-a63c149ceb0e68037df3b7838ed55f6724280b33.zip |
[libcxx] Redo adding support for building and testing with an ABI library not along linker paths
Summary:
This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach:
- `find_library` didn't work with cmake targets (ie in-tree libcxxabi build)
- It wasn't always possible to determine where `find_library` actually found your library.
- `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used.
- Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple.
After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.
Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert
Reviewed By: chandlerc, danalbert
Subscribers: chandlerc, cfe-commits
Differential Revision: http://reviews.llvm.org/D5860
llvm-svn: 220157
Diffstat (limited to 'libcxx/lib')
-rw-r--r-- | libcxx/lib/CMakeLists.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt index d56ade4f2fd..cd8553c3d36 100644 --- a/libcxx/lib/CMakeLists.txt +++ b/libcxx/lib/CMakeLists.txt @@ -36,13 +36,17 @@ if (DEFINED LIBCXX_CXX_ABI_DEPS) endif() # Generate library list. -set(libraries ${LIBCXX_CXX_ABI_LIBRARIES}) +set(libraries ${LIBCXX_CXX_ABI_LIBRARY}) append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread) append_if(libraries LIBCXX_HAS_C_LIB c) append_if(libraries LIBCXX_HAS_M_LIB m) append_if(libraries LIBCXX_HAS_RT_LIB rt) append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s) +#if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path. +if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH) + target_link_libraries(cxx "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}") +endif() target_link_libraries(cxx ${libraries}) # Setup flags. |