summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2014-12-06 13:10:14 -0500
committerAllen Winter <allen.winter@kdab.com>2014-12-06 13:10:14 -0500
commitce972aaef41c0eb69420d152126f94c619d31903 (patch)
tree4f449e6f366cdc6f3520c9de871af867a14dea08 /cmake
parent378da5370cb49e8dc31e0840b22af95b19d7d9a1 (diff)
downloadlibical-git-ce972aaef41c0eb69420d152126f94c619d31903.tar.gz
Resurrect the BDB storage support
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindDB.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/cmake/modules/FindDB.cmake b/cmake/modules/FindDB.cmake
new file mode 100644
index 00000000..5449136d
--- /dev/null
+++ b/cmake/modules/FindDB.cmake
@@ -0,0 +1,49 @@
+# Finds the Berkeley DB Library
+#
+# DB_FOUND - True if Berkeley DB found.
+# DB_INCLUDE_DIR - Directory to include to get Berkeley DB headers
+# DB_LIBRARY - Library to link against for the Berkeley DB
+#
+
+if(DB_INCLUDE_DIR AND DB_LIBRARY)
+ # Already in cache, be silent
+ set(DB_FIND_QUIETLY TRUE)
+endif()
+
+# Look for the header file.
+find_path(
+ DB_INCLUDE_DIR
+ NAMES db.h
+ HINTS /usr/local/opt/db/include
+ DOC "Include directory for the Berkeley DB library"
+)
+mark_as_advanced(DB_INCLUDE_DIR)
+
+# Look for the library.
+find_library(
+ DB_LIBRARY
+ NAMES db
+ HINTS /usr/local/opt/db4/lib
+ DOC "Libraries to link against for the Berkeley DB"
+)
+mark_as_advanced(DB_LIBRARY)
+
+# Copy the results to the output variables.
+if(DB_INCLUDE_DIR AND DB_LIBRARY)
+ set(DB_FOUND 1)
+else()
+ set(DB_FOUND 0)
+endif()
+
+if(DB_FOUND)
+ if(NOT DB_FIND_QUIETLY)
+ message(STATUS "Found Berkeley DB header files in ${DB_INCLUDE_DIR}")
+ message(STATUS "Found Berkeley libraries: ${DB_LIBRARY}")
+ endif()
+else()
+ if(DB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find Berkeley DB")
+ else()
+ message(STATUS "Optional package Berkeley DB was not found")
+ endif()
+endif()