| 1 | # - Try to find Berkeley DB |
| 2 | # Once done this will define |
| 3 | # |
| 4 | # BERKELEY_DB_FOUND - system has Berkeley DB |
| 5 | # BERKELEY_DB_INCLUDE_DIRS - the Berkeley DB include directory |
| 6 | # BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB |
| 7 | # BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB |
| 8 | |
| 9 | # Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org> |
| 10 | # Copyright (c) 2016, Julian Andres Klode <jak@debian.org> |
| 11 | # |
| 12 | # Redistribution and use in source and binary forms, with or without |
| 13 | # modification, are permitted provided that the following conditions |
| 14 | # are met: |
| 15 | # |
| 16 | # 1. Redistributions of source code must retain the copyright |
| 17 | # notice, this list of conditions and the following disclaimer. |
| 18 | # 2. Redistributions in binary form must reproduce the copyright |
| 19 | # notice, this list of conditions and the following disclaimer in the |
| 20 | # documentation and/or other materials provided with the distribution. |
| 21 | # 3. The name of the author may not be used to endorse or promote products |
| 22 | # derived from this software without specific prior written permission. |
| 23 | # |
| 24 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 25 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 26 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 27 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 28 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 29 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 33 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 34 | |
| 35 | |
| 36 | # We need NO_DEFAULT_PATH here, otherwise CMake helpfully picks up the wrong |
| 37 | # db.h on BSD systems instead of the Berkeley DB one. |
| 38 | find_path(BERKELEY_DB_INCLUDE_DIRS db.h |
| 39 | ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db5 |
| 40 | /usr/local/include/db5 |
| 41 | /usr/include/db5 |
| 42 | |
| 43 | ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db4 |
| 44 | /usr/local/include/db4 |
| 45 | /usr/include/db4 |
| 46 | |
| 47 | ${CMAKE_INSTALL_FULL_INCLUDEDIR} |
| 48 | /usr/local/include |
| 49 | /usr/include |
| 50 | |
| 51 | NO_DEFAULT_PATH |
| 52 | ) |
| 53 | |
| 54 | find_library(BERKELEY_DB_LIBRARIES NAMES db db-5) |
| 55 | |
| 56 | include(FindPackageHandleStandardArgs) |
| 57 | find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) |
| 58 | # show the BERKELEY_DB_INCLUDE_DIRS and BERKELEY_DB_LIBRARIES variables only in the advanced view |
| 59 | mark_as_advanced(BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) |