FindBerkeleyDB.cmake 2.5 KB

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