]> git.saurik.com Git - apt.git/commitdiff
CMake: Handle Berkeley DB on FreeBSD
authorJulian Andres Klode <jak@debian.org>
Tue, 23 Aug 2016 10:48:25 +0000 (12:48 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 13:49:14 +0000 (15:49 +0200)
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-<VERSION>, so
let's add db-5 to the list of allowed names.

Gbp-Dch: ignore

CMake/FindBerkeleyDB.cmake
ftparchive/CMakeLists.txt

index 44cfd3ddbe798e7c66f3b2bd693b473b7d4101c9..34bc3b0d16d48d5fb53a8321cb2cc7e0a322e08e 100644 (file)
 # 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)
index 1e1dc36cabe1ac03ab2f06db4ab43dab0ed223c9..799fd733531553487a4d1aaa00d1fa44c3fad3c8 100644 (file)
@@ -1,3 +1,4 @@
+include_directories(${BERKELEY_DB_INCLUDE_DIRS})
 # Create the executable tasks
 file(GLOB_RECURSE source "*.cc")
 add_executable(apt-ftparchive ${source})