Merge branch 'master' of github.com:novacoin-project/novacoin
[novacoin.git] / src / CMakeLists.txt
index 78d5200..94366fe 100644 (file)
@@ -21,9 +21,6 @@ endif(CCACHE_FOUND)
 set (CMAKE_C_FLAGS "-flto -O3 -fPIC -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2")
 set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fexceptions -frtti")
 
-# Add path for custom modules
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/additional/cmake)
-
 set(Boost_USE_STATIC_LIBS   ON)
 find_package(Boost REQUIRED COMPONENTS atomic chrono filesystem program_options system thread)
 set(OPENSSL_USE_STATIC_LIBS ON)
@@ -40,8 +37,8 @@ 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")
+if (NOT EXISTS ${BerkeleyDB_INC}/db_cxx.h)
+    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 +97,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)