From 8efb100c1aed991f576091fcb06dc87dae381d91 Mon Sep 17 00:00:00 2001 From: "Daniel X. Pape" Date: Fri, 17 Apr 2020 18:44:17 -0700 Subject: [PATCH] small changes for building on macOS high sierra, mojave and catalina --- cmake/FindJSONCPP.cmake | 2 +- cmake/FindJSONRPCCPP.cmake | 32 ++++++++++++++++++++++++-------- src/bitcoinapi/CMakeLists.txt | 15 +++++++++------ src/bitcoinapi/exception.h | 6 +++--- src/bitcoinapi/types.h | 2 +- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/cmake/FindJSONCPP.cmake b/cmake/FindJSONCPP.cmake index 64bc183..9a1ecfe 100644 --- a/cmake/FindJSONCPP.cmake +++ b/cmake/FindJSONCPP.cmake @@ -8,7 +8,7 @@ # also defined, but not for general use are # JSONCPP_LIBRARIES, where to find the jsoncpp library. -FIND_PATH(JSONCPP_INCLUDE_DIRS json.h +FIND_PATH(JSONCPP_INCLUDE_DIRS json/json.h /usr/include /usr/local/include ${CMAKE_SOURCE_DIR}/win32-deps/include diff --git a/cmake/FindJSONRPCCPP.cmake b/cmake/FindJSONRPCCPP.cmake index 7ced49a..e7a89da 100644 --- a/cmake/FindJSONRPCCPP.cmake +++ b/cmake/FindJSONRPCCPP.cmake @@ -12,10 +12,24 @@ FIND_PATH(JSONRPCCPP_INCLUDE_DIRS client.h server.h PATH_SUFFIXES jsonrpccpp ) -FIND_LIBRARY(JSONRPCCPP_LIBRARIES +FIND_LIBRARY(JSONRPCCPP_COMMON_LIBRARIES NAMES jsonrpccpp-common + PATHS + /usr/lib + /usr/local/lib +) + +FIND_LIBRARY(JSONRPCCPP_CLIENT_LIBRARIES + NAMES jsonrpccpp-client + PATHS + /usr/lib + /usr/local/lib +) + +FIND_LIBRARY(JSONRPCCPP_SERVER_LIBRARIES + NAMES jsonrpccpp-server PATHS /usr/lib @@ -26,27 +40,29 @@ IF(NOT JSONRPCCPP_INCLUDE_DIRS) MESSAGE("Could not find include dirs") ENDIF(NOT JSONRPCCPP_INCLUDE_DIRS) -IF(NOT JSONRPCCPP_LIBRARIES) +IF(NOT JSONRPCCPP_COMMON_LIBRARIES) MESSAGE("Could not find libraries") -ENDIF(NOT JSONRPCCPP_LIBRARIES) +ENDIF(NOT JSONRPCCPP_COMMON_LIBRARIES) -IF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_LIBRARIES) +IF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_COMMON_LIBRARIES) SET(JSONRPCCPP_FOUND TRUE) -ENDIF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_LIBRARIES) +ENDIF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_COMMON_LIBRARIES) IF(JSONRPCCPP_FOUND) IF(NOT JSONRPCCPP_FIND_QUIETLY) - MESSAGE(STATUS "Found JSON-RPC-CPP: ${JSONRPCCPP_LIBRARIES}") + MESSAGE(STATUS "Found JSON-RPC-CPP: ${JSONRPCCPP_COMMON_LIBRARIES}") ENDIF(NOT JSONRPCCPP_FIND_QUIETLY) ELSE(JSONRPCCPP_FOUND) IF(JSONRPCCPP_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find JSON-RPC-CPP library include: ${JSONRPCCPP_INCLUDE_DIRS}, lib: ${JSONRPCCPP_LIBRARIES}") + MESSAGE(FATAL_ERROR "Could not find JSON-RPC-CPP library include: ${JSONRPCCPP_INCLUDE_DIRS}, lib: ${JSONRPCCPP_COMMON_LIBRARIES}") ENDIF(JSONRPCCPP_FIND_REQUIRED) ENDIF(JSONRPCCPP_FOUND) MARK_AS_ADVANCED( JSONRPCCPP_INCLUDE_DIRS - JSONRPCCPP_LIBRARIES + JSONRPCCPP_COMMON_LIBRARIES + JSONRPCCPP_CLIENT_LIBRARIES + JSONRPCCPP_SERVER_LIBRARIES ) diff --git a/src/bitcoinapi/CMakeLists.txt b/src/bitcoinapi/CMakeLists.txt index 1838b24..39dbb45 100644 --- a/src/bitcoinapi/CMakeLists.txt +++ b/src/bitcoinapi/CMakeLists.txt @@ -13,18 +13,21 @@ ADD_LIBRARY(bitcoinapi_static STATIC ${bitcoinapi_source}) # Set output name of static library SET_TARGET_PROPERTIES(bitcoinapi_static PROPERTIES OUTPUT_NAME bitcoinapi) +TARGET_INCLUDE_DIRECTORIES(bitcoinapi PRIVATE ${JSONCPP_INCLUDE_DIRS} ${JSONRPCCPP_INCLUDE_DIRS}) +TARGET_INCLUDE_DIRECTORIES(bitcoinapi_static PRIVATE ${JSONCPP_INCLUDE_DIRS} ${JSONRPCCPP_INCLUDE_DIRS}) + # Link the library with json-rpc-cpp libs TARGET_LINK_LIBRARIES(bitcoinapi ${CURL_LIBRARY} - ${JSONCPP_LIBRARY} - jsonrpccpp-common - jsonrpccpp-client) + ${JSONCPP_LIBRARIES} + ${JSONRPCCPP_COMMON_LIBRARIES} + ${JSONRPCCPP_CLIENT_LIBRARIES}) TARGET_LINK_LIBRARIES(bitcoinapi_static ${CURL_LIBRARY} - ${JSONCPP_LIBRARY} - jsonrpccpp-common - jsonrpccpp-client) + ${JSONCPP_LIBRARIES} + ${JSONRPCCPP_COMMON_LIBRARIES} + ${JSONRPCCPP_CLIENT_LIBRARIES}) # Set version settings SET(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) diff --git a/src/bitcoinapi/exception.h b/src/bitcoinapi/exception.h index ccdbc3d..4f41748 100644 --- a/src/bitcoinapi/exception.h +++ b/src/bitcoinapi/exception.h @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include using Json::Value; diff --git a/src/bitcoinapi/types.h b/src/bitcoinapi/types.h index 92fa6fa..122f080 100644 --- a/src/bitcoinapi/types.h +++ b/src/bitcoinapi/types.h @@ -13,7 +13,7 @@ #include #include -#include +#include /* === General types === */ struct getinfo_t{