ll-database-binding: allow binding to build with older gdbm libraries
[apps/agl-service-data-persistence.git] / ll-database-binding / conf.d / cmake / FindGDBM.cmake
1 # -*- cmake -*-
2
3 # - Find gdbm
4 # Find the gdbm includes and library
5 # This module defines
6 #  DB_INCLUDE_DIR, where to find db.h, etc.
7 #  DB_LIBRARIES, the libraries needed to use BerkeleyDB.
8 #  DB_FOUND, If false, do not try to use BerkeleyDB.
9 # also defined, but not for general use are
10 #  DB_LIBRARY, where to find the BerkeleyDB library.
11
12 FIND_PATH(DB_INCLUDE_DIR gdbm.h
13   /usr/local/include/gdbm
14   /usr/local/include
15   /usr/include/gdbm
16   /usr/include
17   )
18
19 SET(DB_NAMES ${DB_NAMES} gdbm)
20 FIND_LIBRARY(DB_LIBRARY
21   NAMES ${DB_NAMES}
22   PATHS /usr/lib /usr/local/lib
23   )
24
25 IF (DB_LIBRARY AND DB_INCLUDE_DIR)
26   SET(DB_LIBRARIES ${DB_LIBRARY})
27   SET(DB_FOUND "YES")
28 ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
29   SET(DB_FOUND "NO")
30 ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)
31
32
33 IF (DB_FOUND)
34   IF (NOT DB_FIND_QUIETLY)
35     MESSAGE(STATUS "Found gdbm: ${DB_LIBRARIES}")
36   ENDIF (NOT DB_FIND_QUIETLY)
37 ELSE (DB_FOUND)
38   IF (DB_FIND_REQUIRED)
39     MESSAGE(FATAL_ERROR "Could not find gdbm library")
40   ENDIF (DB_FIND_REQUIRED)
41 ENDIF (DB_FOUND)
42
43 # Deprecated declarations.
44 SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
45 GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)
46
47 MARK_AS_ADVANCED(
48   DB_LIBRARY
49   DB_INCLUDE_DIR
50   )
51