From 74c5026796217f4d51b42aeb727cb04b4f5ce807 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Fri, 24 Dec 2021 11:03:00 +0300 Subject: [PATCH] Tweak berkeley db detection --- CMakeLists.txt | 20 ++++++++++---------- src/CMakeLists.txt | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68e5e30..2702609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,16 +203,16 @@ if (NOT WIN32 AND NOT APPLE) endif() # Try various libdb library file extensions -if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) -else() - message(FATAL_ERROR "Unable to find ${BerkeleyDB_LIB_name} library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable. You can also use BerkeleyDB_LIB_name variable to provide alternative file name search for.") +foreach(ext a so dylib lib) +if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + set (BDB_FOUND True) + break() +endif() +endforeach() + +if (NOT BDB_FOUND) + message(FATAL_ERROR "Unable to find ${BerkeleyDB_LIB_name} library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable. You can also use BerkeleyDB_LIB_name variable to provide alternative file name search for.") endif() list(APPEND ALL_DEFINITIONS QT_GUI USE_QRCODE USE_IPV6) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2fd5f7d..dfe1ace 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,16 +116,16 @@ if (NOT WIN32 AND NOT APPLE) endif() # Try various libdb library file extensions -if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) -else() - message(FATAL_ERROR "Unable to find ${BerkeleyDB_LIB_name} library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable. You can also use BerkeleyDB_LIB_name variable to provide alternative file name search for.") +foreach(ext a so dylib lib) +if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + set (BDB_FOUND True) + break() +endif() +endforeach() + +if (NOT BDB_FOUND) + message(FATAL_ERROR "Unable to find ${BerkeleyDB_LIB_name} library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable. You can also use BerkeleyDB_LIB_name variable to provide alternative file name search for.") endif() if(USE_LEVELDB) -- 1.7.1