diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -231,18 +231,6 @@ if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxx_shared) endif() - cxx_link_system_libraries(cxx_shared) - target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES}) - set_target_properties(cxx_shared - PROPERTIES - COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" - LINK_FLAGS "${LIBCXX_LINK_FLAGS}" - OUTPUT_NAME "c++" - VERSION "${LIBCXX_ABI_VERSION}.0" - SOVERSION "${LIBCXX_ABI_VERSION}" - DEFINE_SYMBOL "" - ) - cxx_set_common_defines(cxx_shared) # Link against LLVM libunwind if (LIBCXXABI_USE_LLVM_UNWINDER) @@ -269,6 +257,19 @@ list(APPEND LIBCXX_INTERFACE_LIBRARIES "${LIBCXX_CXX_SHARED_ABI_LIBRARY}") # For the linker script endif() + cxx_link_system_libraries(cxx_shared) + target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES}) + set_target_properties(cxx_shared + PROPERTIES + COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" + LINK_FLAGS "${LIBCXX_LINK_FLAGS}" + OUTPUT_NAME "c++" + VERSION "${LIBCXX_ABI_VERSION}.0" + SOVERSION "${LIBCXX_ABI_VERSION}" + DEFINE_SYMBOL "" + ) + cxx_set_common_defines(cxx_shared) + # Maybe re-export symbols from libc++abi if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR LIBCXX_CXX_ABI_LIBNAME STREQUAL "default")