check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
if (NOT LIBCXXABI_USE_COMPILER_RT)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
+ check_library_exists(gcc __aeabi_uldivmod "" LIBCXXABI_HAS_GCC_LIB)
endif ()
# libc++abi is built with -nodefaultlibs, so we want all our checks to also
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
- elseif (LIBCXXABI_HAS_GCC_S_LIB)
- list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ else ()
+ if (LIBCXXABI_HAS_GCC_S_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+ endif ()
+ if (LIBCXXABI_HAS_GCC_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
+ endif ()
endif ()
if (MINGW)
# Mingw64 requires quite a few "C" runtime libraries in order for basic
list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
endif()
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+ add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
+endif ()
+
# Setup flags.
add_link_flags_if_supported(-nodefaultlibs)