MSYS2+MINGW64 platform with libbacktrace (#166)

I've updated cmake conditions, to allow libbacktrace usage under
mingw64. And fixed one compilation issue.
Tested with package
https://packages.msys2.org/package/mingw-w64-x86_64-libbacktrace
with this setup:
```
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE=On
```
This commit is contained in:
Pavol Gono 2024-09-04 02:58:39 +02:00 committed by GitHub
parent f671819510
commit 26093d5791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -82,13 +82,13 @@ endif()
if(NOT WIN32) if(NOT WIN32)
check_support(HAS_UNWIND has_unwind.cpp "" "" "") check_support(HAS_UNWIND has_unwind.cpp "" "" "")
check_support(HAS_EXECINFO has_execinfo.cpp "" "" "") check_support(HAS_EXECINFO has_execinfo.cpp "" "" "")
check_support(HAS_BACKTRACE has_backtrace.cpp "" "backtrace" "${CPPTRACE_BACKTRACE_PATH_DEFINITION}")
set(STACKTRACE_LINK_LIB "stdc++_libbacktrace")
else() else()
check_support(HAS_STACKWALK has_stackwalk.cpp "" "dbghelp" "") check_support(HAS_STACKWALK has_stackwalk.cpp "" "dbghelp" "")
endif() endif()
if(NOT WIN32 OR MINGW) if(NOT WIN32 OR MINGW)
check_support(HAS_BACKTRACE has_backtrace.cpp "" "backtrace" "${CPPTRACE_BACKTRACE_PATH_DEFINITION}")
set(STACKTRACE_LINK_LIB "stdc++_libbacktrace")
check_support(HAS_CXX_EXCEPTION_TYPE has_cxx_exception_type.cpp "" "" "") check_support(HAS_CXX_EXCEPTION_TYPE has_cxx_exception_type.cpp "" "" "")
endif() endif()

View File

@ -13,7 +13,7 @@
namespace cpptrace { namespace cpptrace {
namespace detail { namespace detail {
inline std::string program_name() { inline const char* program_name() {
static std::mutex mutex; static std::mutex mutex;
const std::lock_guard<std::mutex> lock(mutex); const std::lock_guard<std::mutex> lock(mutex);
static std::string name; static std::string name;