diff options
author | Martin Storsjo <martin@martin.st> | 2017-10-02 20:46:37 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2017-10-02 20:46:37 +0000 |
commit | f6b13c346dcda30dc00569faaa6968f0f3541d23 (patch) | |
tree | ece67054e55aa59dbbc4f6812d2b5b2a5cf158b5 | |
parent | 02a106e21983b0990770344ce7e1678a1b932d66 (diff) |
Add CMake support for building for MinGW
This section is similar to what already exists in libcxx and libcxxabi.
Differential Revision: https://reviews.llvm.org/D38380
git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@314716 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/config-ix.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 40a5dd1..e2041af 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -29,6 +29,19 @@ if (LIBUNWIND_HAS_NODEFAULTLIBS_FLAG) elseif (LIBUNWIND_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) endif () + if (MINGW) + # Mingw64 requires quite a few "C" runtime libraries in order for basic + # programs to link successfully with -nodefaultlibs. + if (LIBUNWIND_USE_COMPILER_RT) + set(MINGW_RUNTIME ${LIBUNWIND_BUILTINS_LIBRARY}) + else () + set(MINGW_RUNTIME gcc_s gcc) + endif() + set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32 + shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} + 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") endif () |