[PATCH] D38380: [libunwind] Add CMake support for building for MinGW

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 13:48:20 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL314716: Add CMake support for building for MinGW (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D38380?vs=117046&id=117417#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38380

Files:
  libunwind/trunk/cmake/config-ix.cmake


Index: libunwind/trunk/cmake/config-ix.cmake
===================================================================
--- libunwind/trunk/cmake/config-ix.cmake
+++ libunwind/trunk/cmake/config-ix.cmake
@@ -29,6 +29,19 @@
   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 ()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38380.117417.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171002/2525ec5a/attachment.bin>


More information about the cfe-commits mailing list