)
if (NOT WIN32)
- # Execinfo is needed for generating backtraces
- find_package(ExecInfo QUIET)
- set_package_properties(ExecInfo PROPERTIES TYPE OPTIONAL
- DESCRIPTION "a library for inspecting backtraces"
+ # Needed for generating backtraces
+ find_package(Backtrace QUIET)
+ set_package_properties(Backtrace PROPERTIES TYPE RECOMMENDED
+ DESCRIPTION "a header (and possibly library) for inspecting backtraces"
PURPOSE "Used for generating backtraces in case of a crash"
)
endif()
+++ /dev/null
-# Set up execinfo
-
-# The problem with this library is that it is built-in in the Linux glib,
-# while on systems like FreeBSD, it is installed separately and thus needs to be linked to.
-# Therefore, we search for the header to see if the it's available in the first place.
-# If it is available, we try to locate the library to figure out whether it is built-in or not.
-
-find_path(EXECINFO_INCLUDES "execinfo.h")
-
-if(EXECINFO_INCLUDES)
- # We found the header file's include dir.
-
- # Now determine if it's built-in or not, by searching the library file.
- find_library(EXECINFO_LIBRARIES "execinfo")
-
- if(NOT EXECINFO_LIBRARIES)
- # Built-in, no further action is needed
- set(EXECINFO_LIBRARIES "")
- message(STATUS "Found execinfo (built-in)")
- else()
- # It's an external library.
- message(STATUS "Found execinfo: ${EXECINFO_LIBRARIES}")
- endif()
-
- set(EXECINFO_FOUND true)
-
-endif()
set(SOURCES ${SOURCES} mac_utils.cpp)
endif()
-if (WIN32)
- set(SOURCES ${SOURCES} logbacktrace_win.cpp windowssignalwatcher.cpp)
-else()
- if (EXECINFO_FOUND)
- add_definitions(-DHAVE_EXECINFO)
- include_directories(${EXECINFO_INCLUDES})
- endif()
- set(SOURCES ${SOURCES} logbacktrace_unix.cpp posixsignalwatcher.cpp)
-endif()
-
qt5_add_resources(SOURCES ${COMMON_RCS})
add_library(mod_common STATIC ${SOURCES})
qt5_use_modules(mod_common Core Network)
+if (WIN32)
+ target_sources(mod_common PRIVATE logbacktrace_win.cpp windowssignalwatcher.cpp)
+else()
+ if (Backtrace_FOUND)
+ configure_file(backtrace_config.h.in backtrace_config.h)
+ target_compile_definitions(mod_common PRIVATE -DHAVE_BACKTRACE)
+ target_include_directories(mod_common PRIVATE ${Backtrace_INCLUDE_DIRS})
+ target_link_libraries(mod_common PRIVATE ${Backtrace_LIBRARIES})
+ endif()
+ target_sources(mod_common PRIVATE logbacktrace_unix.cpp posixsignalwatcher.cpp)
+endif()
+
if (APPLE)
target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation")
endif()
-target_link_libraries(mod_common ${CMAKE_DL_LIBS} ${EXECINFO_LIBRARIES} ZLIB::ZLIB)
+target_link_libraries(mod_common ${CMAKE_DL_LIBS} ZLIB::ZLIB)
# This is needed so translations are generated before trying to build the qrc.
# Should probably find a nicer solution with proper dependencies between the involved files, though...
--- /dev/null
+#cmakedefine01 Backtrace_FOUND
+#if Backtrace_FOUND
+# include <${Backtrace_HEADER}>
+#endif
#include "quassel.h"
-#if defined(HAVE_EXECINFO) && !defined(Q_OS_MAC)
+#if defined(HAVE_BACKTRACE) && !defined(Q_OS_MAC)
# define BUILD_CRASHHANDLER
-# include <execinfo.h>
# include <dlfcn.h>
# include <cxxabi.h>
# include <QFile>
# include <QTextStream>
# include <QDebug>
+# include "backtrace_config.h"
#endif
void Quassel::logBacktrace(const QString &filename)
registerSignal(SIGTERM);
registerSignal(SIGHUP);
-#ifdef HAVE_EXECINFO
+#ifdef HAVE_BACKTRACE
// we only handle crashes ourselves if coredumps are disabled
struct rlimit *limit = (rlimit *)malloc(sizeof(struct rlimit));
int rc = getrlimit(RLIMIT_CORE, limit);