Skip to content

Commit

Permalink
Add CMake support for building for MinGW
Browse files Browse the repository at this point in the history
This section is similar to what already exists in libcxx and libcxxabi.

Differential Revision: https://reviews.llvm.org/D38380

llvm-svn: 314716
  • Loading branch information
mstorsjo committed Oct 2, 2017
1 parent c6baa85 commit 3a21331
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libunwind/cmake/config-ix.cmake
Expand Up @@ -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 ()
Expand Down

0 comments on commit 3a21331

Please sign in to comment.