diff --git a/CMakeLists.txt b/CMakeLists.txt index 94655a8fc..fc5c0e73d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF) option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF) option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF) option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF) +option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF) # Basic compiler and cmake configurations set(CMAKE_CXX_STANDARD 23) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 13a08ecc7..ec258a8e3 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -515,25 +515,27 @@ macro(addBundledLibraries) set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR}) endif() - if (WIN32) - message(STATUS "StackWalk enabled!") - set(LIBBACKTRACE_LIBRARIES DbgHelp.lib) - else () - find_package(Backtrace) - if (${Backtrace_FOUND}) - message(STATUS "Backtrace enabled! Header: ${Backtrace_HEADER}") + if (NOT IMHEX_DISABLE_STACKTRACE) + if (WIN32) + message(STATUS "StackWalk enabled!") + set(LIBBACKTRACE_LIBRARIES DbgHelp.lib) + else () + find_package(Backtrace) + if (${Backtrace_FOUND}) + message(STATUS "Backtrace enabled! Header: ${Backtrace_HEADER}") - if (Backtrace_HEADER STREQUAL "execinfo.h") - set(LIBBACKTRACE_LIBRARIES) - set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR}) - add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\") - add_compile_definitions(HEX_HAS_EXECINFO) - elseif (Backtrace_HEADER STREQUAL "backtrace.h") - set(LIBBACKTRACE_LIBRARIES backtrace) - set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR}) - add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\") - add_compile_definitions(HEX_HAS_BACKTRACE) - endif () - endif() + if (Backtrace_HEADER STREQUAL "execinfo.h") + set(LIBBACKTRACE_LIBRARIES) + set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR}) + add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\") + add_compile_definitions(HEX_HAS_EXECINFO) + elseif (Backtrace_HEADER STREQUAL "backtrace.h") + set(LIBBACKTRACE_LIBRARIES backtrace) + set(LIBBACKTRACE_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR}) + add_compile_definitions(BACKTRACE_HEADER=\"${Backtrace_HEADER}\") + add_compile_definitions(HEX_HAS_BACKTRACE) + endif () + endif() + endif () endif () endmacro()