diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-03-03 15:59:51 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-03-03 15:59:51 +0000 |
commit | 0357171f1c2916d353ca328aa006b1e4a22d3efa (patch) | |
tree | ed7dbe944f18e2ac5cf57a51cc135fcbe8f91646 /libcxx/lib | |
parent | 14dbeaadc124c7fc7c94fff8a70dece1a15c4199 (diff) | |
download | bcm5719-llvm-0357171f1c2916d353ca328aa006b1e4a22d3efa.tar.gz bcm5719-llvm-0357171f1c2916d353ca328aa006b1e4a22d3efa.zip |
[libcxx] Add support for linking libc++ against a static ABI library.
Summary:
This patch add the CMake option `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` which, when enabled, will link libc++ against the static version of the ABI library.
Reviewers: mclow.lists, jroelofs, danalbert
Reviewed By: danalbert
Subscribers: compnerd, cfe-commits
Differential Revision: http://reviews.llvm.org/D8017
llvm-svn: 231076
Diffstat (limited to 'libcxx/lib')
-rw-r--r-- | libcxx/lib/CMakeLists.txt | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt index fb09c63fa4d..d50b2cc0fd7 100644 --- a/libcxx/lib/CMakeLists.txt +++ b/libcxx/lib/CMakeLists.txt @@ -34,22 +34,33 @@ else() ) endif() +#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() + if (DEFINED LIBCXX_CXX_ABI_DEPS) add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) endif() +set(libraries "") +if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) + # TODO(ericwf): Remove these GNU specific linker flags and let CMake do the + # configuration. This will be more portable. + list(APPEND libraries "-Wl,--whole-archive" "-Wl,-Bstatic") + list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}") + list(APPEND libraries "-Wl,-Bdynamic" "-Wl,--no-whole-archive") +else() + list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}") +endif() + # Generate library list. -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. |