From 26093d579174c908a58e7f3587735c48abf9a166 Mon Sep 17 00:00:00 2001 From: Pavol Gono <28236775+gpalino@users.noreply.github.com> Date: Wed, 4 Sep 2024 02:58:39 +0200 Subject: [PATCH] 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 ``` --- CMakeLists.txt | 4 ++-- src/platform/program_name.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a95f306..c4c318b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,13 +82,13 @@ endif() if(NOT WIN32) check_support(HAS_UNWIND has_unwind.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() check_support(HAS_STACKWALK has_stackwalk.cpp "" "dbghelp" "") endif() 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 "" "" "") endif() diff --git a/src/platform/program_name.hpp b/src/platform/program_name.hpp index 3257244..a51f677 100644 --- a/src/platform/program_name.hpp +++ b/src/platform/program_name.hpp @@ -13,7 +13,7 @@ namespace cpptrace { namespace detail { - inline std::string program_name() { + inline const char* program_name() { static std::mutex mutex; const std::lock_guard lock(mutex); static std::string name;