aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-28 19:00:18 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-04-28 23:34:51 +0100
commite409e59d29cd8f8480947d80582ac8e93b495e22 (patch)
tree8c0dbed81ff56d17e3704e400c463a379aebbec9 /CMakeLists.txt
parentconnection_basic: avoid gratuitous exception (diff)
downloadmonero-e409e59d29cd8f8480947d80582ac8e93b495e22.tar.xz
Print stack trace on exceptions
if libunwind is found. Useful for debugging logs.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9674404bb..09ca449d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,6 +243,14 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
+find_package(Libunwind)
+if(LIBUNWIND_FOUND)
+ message(STATUS "Using libunwind to provide stack traces")
+ add_definitions("-DHAVE_LIBUNWIND")
+else()
+ message(STATUS "Stack traces disabled")
+endif()
+
if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -274,6 +282,10 @@ if (BERKELEY_DB)
include_directories(${BDB_INCLUDE})
endif()
+# Final setup for libunwind
+include_directories(${LIBUNWIND_INCLUDE})
+link_directories(${LIBUNWIND_LIBRARY_DIRS})
+
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -394,6 +406,7 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=__cxa_throw")
endif()
endif()
@@ -431,6 +444,11 @@ elseif(NOT MSVC)
set(EXTRA_LIBRARIES ${RT})
endif()
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ find_library(DL dl)
+ set(EXTRA_LIBRARIES ${DL})
+endif()
+
include(version.cmake)
add_subdirectory(contrib)