Skip to content

Commit 3a21331

Browse files
committedOct 2, 2017
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 llvm-svn: 314716
1 parent c6baa85 commit 3a21331

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

Diff for: ‎libunwind/cmake/config-ix.cmake

+13
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ if (LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
2929
elseif (LIBUNWIND_HAS_GCC_S_LIB)
3030
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
3131
endif ()
32+
if (MINGW)
33+
# Mingw64 requires quite a few "C" runtime libraries in order for basic
34+
# programs to link successfully with -nodefaultlibs.
35+
if (LIBUNWIND_USE_COMPILER_RT)
36+
set(MINGW_RUNTIME ${LIBUNWIND_BUILTINS_LIBRARY})
37+
else ()
38+
set(MINGW_RUNTIME gcc_s gcc)
39+
endif()
40+
set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
41+
shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
42+
moldname mingwex msvcrt)
43+
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
44+
endif()
3245
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
3346
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
3447
endif ()

0 commit comments

Comments
 (0)
Please sign in to comment.