1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
# Finds the Berkeley DB Library
#
# BDB_FOUND - True if Berkeley DB found.
# BDB_INCLUDE_DIR - Directory to include to get Berkeley DB headers
# BDB_LIBRARY - Library to link against for the Berkeley DB
#
set_package_properties(BDB PROPERTIES
DESCRIPTION "Berkeley DB storage"
URL "https://www.oracle.com/database/berkeley-db"
)
if(BDB_INCLUDE_DIR AND BDB_LIBRARY)
# Already in cache, be silent
set(BDB_FIND_QUIETLY TRUE)
endif()
# Look for the header file.
find_path(
BDB_INCLUDE_DIR
NAMES db.h
HINTS /usr/local/opt/db/include
DOC "Include directory for the Berkeley DB library"
)
mark_as_advanced(BDB_INCLUDE_DIR)
# Look for the library.
find_library(
BDB_LIBRARY
NAMES db
HINTS /usr/local/opt/db4/lib
DOC "Libraries to link against for the Berkeley DB"
)
mark_as_advanced(BDB_LIBRARY)
# Copy the results to the output variables.
if(BDB_INCLUDE_DIR AND BDB_LIBRARY)
set(BDB_FOUND 1)
else()
set(BDB_FOUND 0)
endif()
if(BDB_FOUND)
if(NOT BDB_FIND_QUIETLY)
message(STATUS "Found Berkeley DB header files in ${BDB_INCLUDE_DIR}")
message(STATUS "Found Berkeley libraries: ${BDB_LIBRARY}")
endif()
else()
if(BDB_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Berkeley DB")
else()
message(STATUS "Optional package Berkeley DB was not found")
endif()
endif()
|