Fix Libc++abi linking under MinGW64

llvm-svn: 302760
This commit is contained in:
Eric Fiselier 2017-05-11 03:29:59 +00:00
parent 144019ac22
commit accba012b4
2 changed files with 8 additions and 1 deletions

View File

@ -30,7 +30,10 @@ if (LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
if (MINGW)
# Mingw64 requires quite a few "C" runtime libraries in order for basic
# programs to link successfully with -nodefaultlibs.
list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
set(MINGW_LIBRARIES mingw32 gcc_s gcc moldname mingwex msvcrt advapi32
shell32 user32 kernel32 iconv mingw32 gcc_s gcc moldname
mingwex msvcrt)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
endif()
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")

View File

@ -74,6 +74,10 @@ if (LIBCXXABI_USE_LLVM_UNWINDER)
else()
append_if(libraries LIBCXXABI_HAS_GCC_S_LIB gcc_s)
endif()
if (MINGW)
# MINGW_LIBRARIES is defined in config-ix.cmake
list(APPEND libraries ${MINGW_LIBRARIES})
endif()
# Setup flags.
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)