summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c90e10a966..7c8355c730 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,6 +125,7 @@ option(ENABLE_BUNDLED_PROTOBUF "enable bundled protobuf" False)
option(ENABLE_LOGS_MANAGEMENT_TESTS "enable logs management tests" True)
+option(ENABLE_LIBBACKTRACE "enable libbacktrace" False)
option(ENABLE_SENTRY "enable sentry" False)
option(ENABLE_WEBRTC "enable webrtc" False)
@@ -136,6 +137,23 @@ if(ENABLE_PLUGIN_GO)
find_package(Go "${MIN_GO_VERSION}" REQUIRED)
endif()
+if(ENABLE_LIBBACKTRACE)
+ include(ExternalProject)
+
+ ExternalProject_Add(libbacktrace
+ GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git
+ GIT_TAG master
+ CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
+ BUILD_COMMAND make
+ BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libbacktrace.a
+ UPDATE_DISCONNECTED True
+ INSTALL_COMMAND make install)
+
+ ExternalProject_Get_Property(libbacktrace INSTALL_DIR)
+ set(LIBBACKTRACE_INCLUDE_DIR ${INSTALL_DIR}/include)
+ set(LIBBACKTRACE_LIBRARY ${INSTALL_DIR}/lib/libbacktrace.a)
+endif()
+
if(ENABLE_SENTRY)
include(FetchContent)
@@ -670,6 +688,12 @@ if(ENABLE_PLUGIN_EBPF)
)
endif()
+if(ENABLE_LIBBACKTRACE)
+ list(APPEND LIBNETDATA_FILES
+ src/libnetdata/bt/bt.cc
+ src/libnetdata/bt/bt.h)
+endif()
+
set(LIBH2O_FILES
src/web/server/h2o/libh2o/deps/cloexec/cloexec.c
src/web/server/h2o/libh2o/deps/libgkc/gkc.c
@@ -1506,6 +1530,12 @@ if(ENABLE_PLUGIN_EBPF)
target_link_libraries(libnetdata PUBLIC ${ELF_LIBRARIES})
endif()
+if(ENABLE_LIBBACKTRACE)
+ add_dependencies(libnetdata libbacktrace)
+ target_include_directories(libnetdata PRIVATE ${LIBBACKTRACE_INCLUDE_DIR})
+ target_link_libraries(libnetdata PRIVATE ${LIBBACKTRACE_LIBRARY})
+endif()
+
# judy
target_link_libraries(libnetdata PUBLIC judy)