Change logic of testing for libunwind on OSX and ARM

This commit is contained in:
NanoAkron 2017-01-09 13:38:54 +00:00
parent c6ec939626
commit e68ea86cc4
No known key found for this signature in database
GPG Key ID: 346A337AA2EA8B57
1 changed files with 9 additions and 4 deletions

View File

@ -273,15 +273,20 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}") add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
find_package(Libunwind)
# Can't install hook in static build on OSX, because OSX linker does not support --wrap # Can't install hook in static build on OSX, because OSX linker does not support --wrap
# On ARM, having libunwind package (with .so's only) installed breaks static link. # On ARM, having libunwind package (with .so's only) installed breaks static link.
if(LIBUNWIND_FOUND AND NOT (STATIC AND (APPLE OR ARM))) if(APPLE OR (ARM AND STATIC))
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
else()
find_package(Libunwind)
if(LIBUNWIND_FOUND)
set(DEFAULT_STACK_TRACE ON) set(DEFAULT_STACK_TRACE ON)
else() else()
set(DEFAULT_STACK_TRACE OFF) set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "") set(LIBUNWIND_LIBRARIES "")
endif() endif()
endif()
option(STACK_TRACE "Install a hook that dumps stack on exception" ${DEFAULT_STACK_TRACE}) option(STACK_TRACE "Install a hook that dumps stack on exception" ${DEFAULT_STACK_TRACE})