From b4b3ecd65b04a6f653b51739b9dd25e5600c4f64 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Wed, 28 Oct 2020 10:26:39 +0100 Subject: [PATCH] Compile with -D_GNU_SOURCE Needed by `boost::stacktrace` for `_Unwind_Backtrace()`. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41e63a215..0b39e0097 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,9 +361,13 @@ if(HAVE_LIBEXECINFO) list(APPEND base_DEPS execinfo) endif() +if(NOT WIN32) + # boost::stacktrace uses _Unwind_Backtrace which is only exposed if _GNU_SOURCE is defined on most systems + add_definitions(-D_GNU_SOURCE) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(ICINGA2_STACKTRACE_USE_BACKTRACE_SYMBOLS TRUE) - add_definitions(-D_GNU_SOURCE) endif() if(ICINGA2_STACKTRACE_USE_BACKTRACE_SYMBOLS AND NOT HAVE_BACKTRACE_SYMBOLS)