@ -249,14 +249,29 @@ endif()
add_definitions ( "-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}" )
add_definitions ( "-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}" )
find_package ( Libunwind )
find_package ( Libunwind )
if ( LIBUNWIND_FOUND )
# C a n ' t i n s t a l l h o o k i n s t a t i c b u i l d o n O S X , b e c a u s e O S X l i n k e r d o e s n o t s u p p o r t - - w r a p
message ( STATUS "Using libunwind to provide stack traces" )
if ( LIBUNWIND_FOUND AND NOT ( STATIC AND APPLE ) )
add_definitions( "-DHAVE_LIBUNWIND" )
set( DEFAULT_STACK_TRACE ON )
else ( )
else ( )
message( STATUS "Stack traces disabled" )
set( DEFAULT_STACK_TRACE OFF )
set ( LIBUNWIND_LIBRARIES "" )
set ( LIBUNWIND_LIBRARIES "" )
endif ( )
endif ( )
option ( STACK_TRACE "Install a hook that dumps stack on exception" ${ DEFAULT_STACK_TRACE } )
if ( STACK_TRACE )
message ( STATUS "Stack trace on exception enabled" )
# D o n ' t s e t C M A K E _ * _ F L A G S d i r e c t l y o r a d d _ d e f i n i t i o n s , b e c a u s e t h i s f l a g m u s t
# n o t b e s e t f o r t e s t s targets ( TODO: per-target logic into nested CMakeLists )
set ( STACK_TRACE_C_FLAG "-DSTACK_TRACE" )
if ( STATIC )
set ( STACK_TRACE_LINK_FLAG "-Wl,--wrap=__cxa_throw" )
endif ( )
else ( )
message ( STATUS "Stack trace on exception disabled" )
endif ( )
if ( UNIX AND NOT APPLE )
if ( UNIX AND NOT APPLE )
# N o t e t h a t a t t h e t i m e o f t h i s w r i t i n g t h e - W s t r i c t - p r o t o t y p e s f l a g a d d e d b e l o w w i l l m a k e t h i s f a i l
# N o t e t h a t a t t h e t i m e o f t h i s w r i t i n g t h e - W s t r i c t - p r o t o t y p e s f l a g a d d e d b e l o w w i l l m a k e t h i s f a i l
set ( THREADS_PREFER_PTHREAD_FLAG ON )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
@ -424,11 +439,6 @@ else()
if ( STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD )
if ( STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD )
set ( COMMON_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++" )
set ( COMMON_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++" )
endif ( )
endif ( )
if ( STATIC AND NOT FREEBSD AND NOT OPENBSD )
# I n s t a l l h o o k o n t h r o w f o r d u m p i n g s t a c k o n exception ( implemented in libcommon )
set ( WRAP_CXA_THROW_FLAG "-Wl,--wrap=__cxa_throw" )
endif ( )
endif ( )
endif ( )
if ( ${ BOOST_IGNORE_SYSTEM_PATHS } STREQUAL "ON" )
if ( ${ BOOST_IGNORE_SYSTEM_PATHS } STREQUAL "ON" )
@ -476,12 +486,10 @@ endif()
include ( version.cmake )
include ( version.cmake )
# W h e n b u i l d i n g t h e f o l l o w i n g s o u r c e s . . .
# W h e n b u i l d i n g t h e f o l l o w i n g s o u r c e s t r e a t w a r n i n g s a s e r r o r s , i n s t a l l t h r o w w r a p p e r
# . . . t r e a t w a r n i n g s a s e r r o r s , i n s t a l l t h r o w w r a p p e r
set ( CMAKE_C_FLAGS "${COMMON_C_FLAGS} ${WARNINGS_AS_ERRORS_FLAG} ${STACK_TRACE_C_FLAG}" )
set ( CMAKE_C_FLAGS "${COMMON_C_FLAGS} ${WARNINGS_AS_ERRORS_FLAG}" )
set ( CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS} ${WARNINGS_AS_ERRORS_FLAG} ${STACK_TRACE_C_FLAG}" )
set ( CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS} ${WARNINGS_AS_ERRORS_FLAG}" )
set ( CMAKE_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} ${STACK_TRACE_LINK_FLAG}" )
# . . . i n s t a l l h o o k o n t h r o w
set ( CMAKE_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} ${WRAP_CXA_THROW_FLAG}" )
add_subdirectory ( contrib )
add_subdirectory ( contrib )
add_subdirectory ( src )
add_subdirectory ( src )
@ -490,11 +498,9 @@ add_subdirectory(src)
option ( BUILD_TESTS "Build tests." OFF )
option ( BUILD_TESTS "Build tests." OFF )
if ( BUILD_TESTS )
if ( BUILD_TESTS )
# W h e n b u i l d i n g t e s t s . . .
# W h e n b u i l d i n g t e s t s , d o n ' t a d d s o m e o f t h e f l a g s a d d e d t o s o u r c e b u i l d
# . . . d o * n o t * t r e a t w a r n i n g s a s e r r o r s
set ( CMAKE_C_FLAGS "${COMMON_C_FLAGS}" )
set ( CMAKE_C_FLAGS "${COMMON_C_FLAGS}" )
set ( CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS}" )
set ( CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS}" )
# . . . d o * n o t * i n s t a l l h o o k o n t h r o w
set ( CMAKE_EXE_LINKER_FLAGS "${COMMON_CXX_FLAGS}" )
set ( CMAKE_EXE_LINKER_FLAGS "${COMMON_CXX_FLAGS}" )
add_subdirectory ( tests )
add_subdirectory ( tests )
endif ( )
endif ( )