]> the.earth.li Git - onak.git/blob - cmake/FindBDB.cmake
Handle failed database initialisation more gracefully
[onak.git] / cmake / FindBDB.cmake
1 # No pkg-config support in Berkeley DB, so try to find it manually
2
3 set(BDB_PREFIX "" CACHE PATH "path ")
4
5 find_path(BDB_INCLUDE_DIR db.h
6         PATHS ${BDB_PREFIX}/include /usr/include /usr/local/include)
7
8 find_library(BDB_LIBRARY NAMES db
9         PATHS ${BDB_PREFIX}/lib /usr/lib /usr/local/lib)
10
11 if(BDB_INCLUDE_DIR AND BDB_LIBRARY)
12         get_filename_component(BDB_LIBRARY_DIR ${BDB_LIBRARY} PATH)
13         set(BDB_FOUND TRUE)
14 endif()
15
16 if(BDB_FOUND)
17         if(NOT BDB_FIND_QUIETLY)
18                 MESSAGE(STATUS "Found Berkeley DB: ${BDB_LIBRARY}")
19         endif()
20 elseif(BDB_FOUND)
21         if(BDB_FIND_REQUIRED)
22                 message(FATAL_ERROR "Could not find Berkeley DB")
23         endif()
24 endif()