Skip to content

Commit 934a430

Browse files
Try to fix windows mingw build
1 parent 004ee57 commit 934a430

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

libcxx/src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ if (LIBCXX_ENABLE_SHARED)
254254
list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
255255
endif()
256256

257+
if(WIN32 AND NOT (${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL "MSVC"))
258+
string(APPEND link_libraries " ${CMAKE_LINK_LIBRARY_FLAG}dbghelp")
259+
string(APPEND link_libraries " ${CMAKE_LINK_LIBRARY_FLAG}psapi")
260+
endif()
261+
257262
if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
258263
# Since we most likely do not have a mt.exe replacement, disable the
259264
# manifest bundling. This allows a normal cmake invocation to pass which

libcxx/src/stacktrace/windows_impl.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010

1111
# define WIN32_LEAN_AND_MEAN
1212
# include <windows.h>
13-
//
14-
# include <dbghelp.h>
15-
# include <psapi.h>
16-
//
13+
1714
# include <cstring>
15+
# include <dbghelp.h>
1816
# include <mutex>
17+
# include <psapi.h>
1918
# include <stacktrace>
2019

21-
# pragma comment(lib, "dbghelp.lib")
22-
# pragma comment(lib, "psapi.lib")
20+
# if defined(_MSC_VER)
21+
# pragma comment(lib, "dbghelp.lib")
22+
# pragma comment(lib, "psapi.lib")
23+
# endif
2324

2425
_LIBCPP_BEGIN_NAMESPACE_STD
2526
namespace __stacktrace {

0 commit comments

Comments
 (0)