Update CMake - berkeleydb
[novacoin.git] / src / CMakeLists.txt
index 72aa181..7ce380a 100644 (file)
@@ -41,7 +41,7 @@ set(BerkeleyDB_INC ${BerkeleyDB_ROOT}/include)
 endif()
 
 if (NOT EXISTS ${BerkeleyDB_INC}/db_cxx.h)
-    message(FATAL_ERROR "Unable to find db_cxx.h header file in ${BerkeleyDB_INC} directory")
+    message(FATAL_ERROR "Unable to find db_cxx.h header file in ${BerkeleyDB_INC} directory. Try to specify either include directory path via BerkeleyDB_INC or berkeley db root path via BerkeleyDB_ROOT variable.")
 endif()
 
 # Set default library path for berkeley db
@@ -100,7 +100,18 @@ elseif(EXISTS ${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")
+    set(BerkeleyDB_LIBS ${BerkeleyDB_ROOT}/lib/x86_64-linux-gnu)
+    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. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable.")
+    endif()
 endif()
 
 if(USE_LEVELDB)