[libunwind] r314716 - Add CMake support for building for MinGW
Martin Storsjo via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 13:46:37 PDT 2017
Author: mstorsjo
Date: Mon Oct 2 13:46:37 2017
New Revision: 314716
URL: http://llvm.org/viewvc/llvm-project?rev=314716&view=rev
Log:
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
Modified:
libunwind/trunk/cmake/config-ix.cmake
Modified: libunwind/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/config-ix.cmake?rev=314716&r1=314715&r2=314716&view=diff
==============================================================================
--- libunwind/trunk/cmake/config-ix.cmake (original)
+++ libunwind/trunk/cmake/config-ix.cmake Mon Oct 2 13:46:37 2017
@@ -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 ()
More information about the cfe-commits
mailing list