diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f74f59e3..637e9c4e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) enable_testing() option(BUILD_DOCUMENTATION "Build the Doxygen documentation." ON) +option(BUILD_TESTS "Build tests." OFF) # Check whether we're on a 32-bit or 64-bit system if(CMAKE_SIZEOF_VOID_P EQUAL "8") @@ -293,11 +294,13 @@ add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}") # 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. +# When possible, avoid stack tracing using libunwind in favor of using easylogging++. if (APPLE) set(DEFAULT_STACK_TRACE OFF) set(LIBUNWIND_LIBRARIES "") elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW) set(DEFAULT_STACK_TRACE ON) + set(STACK_TRACE_LIB "easylogging++") # for diag output only set(LIBUNWIND_LIBRARIES "") elseif (ARM AND STATIC) set(DEFAULT_STACK_TRACE OFF) @@ -306,6 +309,7 @@ else() find_package(Libunwind) if(LIBUNWIND_FOUND) set(DEFAULT_STACK_TRACE ON) + set(STACK_TRACE_LIB "libunwind") # for diag output only else() set(DEFAULT_STACK_TRACE OFF) set(LIBUNWIND_LIBRARIES "") @@ -315,7 +319,7 @@ 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") + message(STATUS "Stack trace on exception enabled (using ${STACK_TRACE_LIB})") else() message(STATUS "Stack trace on exception disabled") endif() @@ -326,7 +330,7 @@ if (UNIX AND NOT APPLE) find_package(Threads) endif() -# Handle OpenSSL, used for sha256sum on binary updates +# Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http if (APPLE AND NOT IOS) if (NOT OpenSSL_DIR) EXECUTE_PROCESS(COMMAND brew --prefix openssl @@ -337,6 +341,8 @@ if (APPLE AND NOT IOS) endif() find_package(OpenSSL REQUIRED) +message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}") +include_directories(${OPENSSL_INCLUDE_DIR}) if(STATIC AND NOT IOS) if(UNIX) set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS};${CMAKE_THREAD_LIBS_INIT}") @@ -452,7 +458,11 @@ else() option(NO_AES "Explicitly disable AES support" ${NO_AES}) - if(NOT NO_AES AND NOT ARM AND NOT PPC64LE) + if(NO_AES) + message(STATUS "AES support explicitly disabled") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES") + elseif(NOT ARM AND NOT PPC64LE) message(STATUS "AES support enabled") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") @@ -648,6 +658,11 @@ if(NOT Boost_FOUND) die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.58) or the equivalent") elseif(Boost_FOUND) message(STATUS "Found Boost Version: ${Boost_VERSION}") + if (Boost_VERSION VERSION_LESS 1.62 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1)) + message(FATAL_ERROR "Boost older than 1.62 is too old to link with OpenSSL 1.1 or newer. " + "Update Boost or install OpenSSL 1.0 and set path to it when running cmake: " + "cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0;/usr/lib/openssl-1.0'") + endif() endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) @@ -688,10 +703,10 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS) list(APPEND EXTRA_LIBRARIES ${ATOMIC}) endif() -include(version.cmake) - find_path(ZMQ_INCLUDE_PATH zmq.hpp) find_library(ZMQ_LIB zmq) +find_library(PGM_LIBRARY pgm) +find_library(NORM_LIBRARY norm) find_library(SODIUM_LIBRARY sodium) if(NOT ZMQ_INCLUDE_PATH) @@ -700,24 +715,23 @@ endif() if(NOT ZMQ_LIB) message(FATAL_ERROR "Could not find required libzmq") endif() +if(PGM_LIBRARY) + set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}") +endif() +if(NORM_LIBRARY) + set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}") +endif() if(SODIUM_LIBRARY) set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}") endif() -option(BUILD_TESTS "Build tests." OFF) +add_subdirectory(contrib) +add_subdirectory(src) if(BUILD_TESTS) add_subdirectory(tests) endif() -# warnings are cleared only for GCC on Linux -if (NOT (MINGW OR APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY)) -add_compile_options("${WARNINGS_AS_ERRORS_FLAG}") # applies only to targets that follow -endif() - -add_subdirectory(contrib) -add_subdirectory(src) - if(BUILD_DOCUMENTATION) set(DOC_GRAPHS "YES" CACHE STRING "Create dependency graphs (needs graphviz)") set(DOC_FULLGRAPHS "NO" CACHE STRING "Create call/callee graphs (large)") |