From 24ad9b325f2d277864e3a75931137b93dd75cd03 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 12:48:25 +0200 Subject: CMake: Handle Berkeley DB on FreeBSD The BSD systems still ship their own db.h with a historical BSD implementation, which is preferred by CMake, as it searches its default path first. We thus have to disable the DEFAULT_PATH for the search, unfortunately. We also need to pass the correct include directory to the target. Furthermore, on FreeBSD the library is called db-, so let's add db-5 to the list of allowed names. Gbp-Dch: ignore --- CMake/FindBerkeleyDB.cmake | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'CMake') diff --git a/CMake/FindBerkeleyDB.cmake b/CMake/FindBerkeleyDB.cmake index 44cfd3ddb..34bc3b0d1 100644 --- a/CMake/FindBerkeleyDB.cmake +++ b/CMake/FindBerkeleyDB.cmake @@ -33,14 +33,25 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# We need NO_DEFAULT_PATH here, otherwise CMake helpfully picks up the wrong +# db.h on BSD systems instead of the Berkeley DB one. find_path(BERKELEY_DB_INCLUDE_DIRS db.h - /usr/include/db5 + ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db5 /usr/local/include/db5 - /usr/include/db4 + /usr/include/db5 + + ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db4 /usr/local/include/db4 + /usr/include/db4 + + ${CMAKE_INSTALL_FULL_INCLUDEDIR} + /usr/local/include + /usr/include + + NO_DEFAULT_PATH ) -find_library(BERKELEY_DB_LIBRARIES NAMES db ) +find_library(BERKELEY_DB_LIBRARIES NAMES db db-5) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) -- cgit v1.2.3