diff --git a/CMakeLists.txt b/CMakeLists.txt index c6c4f8a..b936bb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,14 +71,21 @@ endif() stacktrace_check(BOOST_STACKTRACE_HAS_WINDBG has_windbg.cpp "" "dbgeng;ole32" "") stacktrace_check(BOOST_STACKTRACE_HAS_WINDBG_CACHED has_windbg_cached.cpp "${CMAKE_CURRENT_SOURCE_DIR}/../config/include" "dbgeng;ole32" "") +set(_default_from_exception ON) +if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64|i386|i686|x86") + set(_default_from_exception OFF) +endif() + option(BOOST_STACKTRACE_ENABLE_NOOP "Boost.Stacktrace: build boost_stacktrace_noop" ON) option(BOOST_STACKTRACE_ENABLE_BACKTRACE "Boost.Stacktrace: build boost_stacktrace_backtrace" ${BOOST_STACKTRACE_HAS_BACKTRACE}) option(BOOST_STACKTRACE_ENABLE_ADDR2LINE "Boost.Stacktrace: build boost_stacktrace_addr2line" ${_default_addr2line}) option(BOOST_STACKTRACE_ENABLE_BASIC "Boost.Stacktrace: build boost_stacktrace_basic" ON) option(BOOST_STACKTRACE_ENABLE_WINDBG "Boost.Stacktrace: build boost_stacktrace_windbg" ${BOOST_STACKTRACE_HAS_WINDBG}) option(BOOST_STACKTRACE_ENABLE_WINDBG_CACHED "Boost.Stacktrace: build boost_stacktrace_windbg_cached" ${BOOST_STACKTRACE_HAS_WINDBG_CACHED}) +option(BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION "Boost.Stacktrace: build boost_stacktrace_from_exception" ${_default_from_exception}) unset(_default_addr2line) +unset(_default_from_exception) message(STATUS "Boost.Stacktrace: " "noop ${BOOST_STACKTRACE_ENABLE_NOOP}, " @@ -86,7 +93,8 @@ message(STATUS "Boost.Stacktrace: " "addr2line ${BOOST_STACKTRACE_ENABLE_ADDR2LINE}, " "basic ${BOOST_STACKTRACE_ENABLE_BASIC}, " "windbg ${BOOST_STACKTRACE_ENABLE_WINDBG}, " - "windbg_cached ${BOOST_STACKTRACE_ENABLE_WINDBG_CACHED}" + "windbg_cached ${BOOST_STACKTRACE_ENABLE_WINDBG_CACHED}, " + "from_exception ${BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION}" ) stacktrace_add_library(noop ${BOOST_STACKTRACE_ENABLE_NOOP} "" "") @@ -95,6 +103,7 @@ stacktrace_add_library(addr2line ${BOOST_STACKTRACE_ENABLE_ADDR2LINE} "${CMAKE_D stacktrace_add_library(basic ${BOOST_STACKTRACE_ENABLE_BASIC} "${CMAKE_DL_LIBS}" "") stacktrace_add_library(windbg ${BOOST_STACKTRACE_ENABLE_WINDBG} "dbgeng;ole32" "_GNU_SOURCE=1") stacktrace_add_library(windbg_cached ${BOOST_STACKTRACE_ENABLE_WINDBG_CACHED} "dbgeng;ole32" "_GNU_SOURCE=1") +stacktrace_add_library(from_exception ${BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION} "${CMAKE_DL_LIBS}" "") # boost_stacktrace, default library @@ -123,6 +132,10 @@ elseif(BOOST_STACKTRACE_ENABLE_NOOP) target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_noop) +elseif(BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION) + + target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_from_exception) + endif() # diff --git a/src/from_exception.cpp b/src/from_exception.cpp index f6cb39c..7b8f937 100644 --- a/src/from_exception.cpp +++ b/src/from_exception.cpp @@ -4,6 +4,8 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS + #if defined(_MSC_VER) #include