@@ -8,22 +8,22 @@ Module defines the following `IMPORTED` target(s):
88
99* `Dbm::Dbm` - The package library, if found.
1010
11- Result variables:
11+ ## Result variables
1212
1313* `Dbm_FOUND` - Whether the package has been found.
1414* `Dbm_INCLUDE_DIRS` - Include directories needed to use this package.
1515* `Dbm_LIBRARIES` - Libraries needed to link to the package library.
1616* `Dbm_IMPLEMENTATION` - String of the library name that implements the dbm
1717 library.
1818
19- Cache variables:
19+ ## Cache variables
2020
2121* `Dbm_INCLUDE_DIR` - Directory containing package library headers.
2222* `Dbm_LIBRARY` - The path to the package library.
2323
24- Hints:
24+ ## Hints
2525
26- The `Dbm_ROOT` variable adds custom search path.
26+ * The `Dbm_ROOT` variable adds custom search path.
2727#]=============================================================================]
2828
2929include (CheckLibraryExists)
@@ -50,21 +50,22 @@ if(NOT Dbm_INCLUDE_DIR)
5050 string (APPEND _reason "dbm.h not found. " )
5151endif ()
5252
53- # TODO: Fix the search names and the sanity check.
5453find_library (
5554 Dbm_LIBRARY
56- NAMES gdbm_compat
57- DOC "The path to the dbm compat library"
55+ NAMES
56+ gdbm_compat
57+ dbm
58+ # TODO: Which system still has dbm built in the default C library? In such
59+ # case this find module should be refactored to search the built-in library
60+ # similar to how FindIconv does it. Otherwise, more likely, this should be
61+ # removed from here.
62+ c
63+ DOC "The path to the dbm library"
5864)
5965
60- if (Dbm_LIBRARY)
66+ if (Dbm_LIBRARY MATCHES "gdbm_compat" )
6167 set (Dbm_IMPLEMENTATION "GDBM" )
62- else ()
63- find_library (
64- Dbm_LIBRARY
65- NAMES dbm c
66- DOC "The path to the dbm library"
67- )
68+ elseif (Dbm_LIBRARY)
6869 set (Dbm_IMPLEMENTATION "DBM" )
6970endif ()
7071
0 commit comments