aboutsummaryrefslogtreecommitdiff
path: root/dep
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2021-02-21 22:16:13 +0100
committerGitHub <noreply@github.com>2021-02-21 22:16:13 +0100
commitdc78b5a6a7410092df7ac426fbb2f2551072c889 (patch)
tree4e05e6b829d27344a1dbb053d71ec10661e8e217 /dep
parentf96aab2186d17ddd286fa42913f3f14e9562c4eb (diff)
CMake: Add WITH_BOOST_STACKTRACE option to use libbacktrace (#26119)
* CMake: Add WITH_BOOST_STACKTRACE option to use libbacktrace * Allow to specify where backtrace.h header is with cmake option -DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE="/usr/lib/gcc/x86_64-linux-gnu/10/include/backtrace.h" Co-authored-by: Trond B. Krokli <38162891+illfated@users.noreply.github.com>
Diffstat (limited to 'dep')
-rw-r--r--dep/boost/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt
index bbb9e9ab577..9f4fa907bc5 100644
--- a/dep/boost/CMakeLists.txt
+++ b/dep/boost/CMakeLists.txt
@@ -83,3 +83,25 @@ endif()
target_compile_definitions(boost
INTERFACE
-DTC_HAS_BROKEN_WSTRING_REGEX)
+
+if (WITH_BOOST_STACKTRACE AND NOT WIN32)
+ message("*** libbacktrace will be linked")
+
+ if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE)
+ CHECK_INCLUDE_FILE(${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE} HAS_BACKTRACE)
+ else()
+ CHECK_INCLUDE_FILE("backtrace.h" HAS_BACKTRACE)
+ endif()
+
+ if (NOT HAS_BACKTRACE)
+ message(FATAL_ERROR "Required header 'backtrace.h' not found. If building with a compiler other than GCC, please specify the full path in the CMake option BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE.")
+ endif()
+
+ target_compile_definitions(boost
+ INTERFACE
+ -DBOOST_STACKTRACE_USE_BACKTRACE)
+
+ target_link_libraries(boost
+ INTERFACE
+ backtrace)
+endif()