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 | cb7e32c2909fab8487f66a320379a06f7a28b7c2 (patch) | |
tree | e7849c9628fc32cd1199d98b21a9fe1cbff58608 /cmake | |
parent | f4c53dacafe0ee3a08ba602f3cc6645815bbdfb0 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/HandleLibCXXABI.cmake | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake index 8a9f8632d..ff830d5f2 100644 --- a/cmake/Modules/HandleLibCXXABI.cmake +++ b/cmake/Modules/HandleLibCXXABI.cmake @@ -8,41 +8,21 @@ # # Parameters: # abidefines: A list of defines needed to compile libc++ with the ABI library -# abilibs : A list of libraries to link against +# abilib : The ABI library to link against. # abifiles : A list of files (which may be relative paths) to copy into the # libc++ build tree for the build. These files will also be # installed alongside the libc++ headers. # abidirs : A list of relative paths to create under an include directory # in the libc++ build directory. # -macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs) +macro(setup_abi_lib abipathvar abidefines abilib abifiles abidirs) list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines}) set(${abipathvar} "${${abipathvar}}" CACHE PATH "Paths to C++ ABI header directories separated by ';'." FORCE ) - # To allow for libraries installed along non-default paths we use find_library - # to locate the ABI libraries we want. Making sure to clean the cache before - # each run of find_library. - set(LIBCXX_CXX_ABI_LIBRARIES "") - foreach(alib ${abilibs}) - # cxxabi is a cmake target and not a library. - # Handle this special case explicitly. - # Otherwise use find_library to locate the correct binary. - if (alib STREQUAL "cxxabi") - list(APPEND LIBCXX_CXX_ABI_LIBRARIES cxxabi) - else() - unset(_Res CACHE) - find_library(_Res ${alib}) - if (${_Res} STREQUAL "_Res-NOTFOUND") - message(FATAL_ERROR "Failed to find ABI library: ${alib}") - else() - message(STATUS "Adding ABI library: ${_Res}") - list(APPEND LIBCXX_CXX_ABI_LIBRARIES ${_Res}) - endif() - endif() - endforeach() + set(LIBCXX_CXX_ABI_LIBRARY ${abilib}) set(LIBCXX_ABILIB_FILES ${abifiles}) |