From: CryptoManiac Date: Mon, 20 Dec 2021 07:51:57 +0000 (+0300) Subject: Better detection of berkeleydb X-Git-Tag: nvc-v0.5.9~96 X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=86265b6bfbece40534f26c3827e66100ed0e493e;hp=4f08c5536ca06a0f273a3b4a00e4307e2ca4e8e2;p=novacoin.git Better detection of berkeleydb --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bb7deb..78d5200 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,6 +40,10 @@ if (NOT BerkeleyDB_INC) set(BerkeleyDB_INC ${BerkeleyDB_ROOT}/include) endif() +if (NOT EXISTS ${BerkeleyDB_ROOT}/include/db_cxx.h) + message(FATAL_ERROR "Unable to find db_cxx.h header file in ${BerkeleyDB_ROOT}/include directory") +endif() + # Set default library path for berkeley db if (NOT BerkeleyDB_LIBS) set(BerkeleyDB_LIBS ${BerkeleyDB_ROOT}/lib) @@ -84,9 +88,27 @@ set(generic_sources ) list(APPEND ALL_SOURCES ${generic_sources}) -list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.a ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto) +list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto) + +# Try various libdb library file extensions +if (EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.a) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.a) +elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.so) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.so) +elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dylib) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dylib) +elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dll) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dll) +else() + message(FATAL_ERROR "Unable to find libdb_cxx library in ${BerkeleyDB_LIBS} directory") +endif() if(USE_LEVELDB) + # Disable useless targets + option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" OFF) + option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" OFF) + option(LEVELDB_INSTALL "Install LevelDB's header and library" OFF) + add_subdirectory(additional/leveldb) list(APPEND ALL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/txdb-leveldb.cpp) list(APPEND ALL_LIBRARIES leveldb)