1 # Key database backends
3 # These have no dependencies and can always be compiled
4 set(BACKENDS "file" "fs" "keyring" "stacked")
6 # DB4 backend (add check for existence)
9 LIST(APPEND BACKENDS db4)
10 set(BACKEND_db4_LIBS db)
13 # HKP backend - needs libcurl
14 pkg_check_modules(CURL libcurl)
16 LIST(APPEND BACKENDS hkp)
17 set(BACKEND_hkp_INC ${CURL_INCLUDE_DIRS})
18 set(BACKEND_hkp_LIBS ${CURL_LIBRARIES})
21 # PostgreSQL backend - needs libpq
22 pkg_check_modules(POSTGRESQL libpq)
24 LIST(APPEND BACKENDS pg)
25 set(BACKEND_pg_INC ${POSTGRESQL_INCLUDE_DIRS})
26 set(BACKEND_pg_LIBS ${POSTGRESQL_LIBRARIES})
29 # keyd backend - can be disabled entirely
30 if (KEYD STREQUAL "ON")
31 LIST(APPEND BACKENDS keyd)
33 add_executable(keyd keyd.c)
34 target_link_libraries(keyd libonak)
35 add_executable(keydctl keydctl.c ../onak-conf.c)
36 target_link_libraries(keydctl libonak)
37 target_compile_definitions(keydctl PRIVATE
38 CONFIGDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
40 pkg_check_modules(SYSTEMD libsystemd)
42 set(HAVE_SYSTEMD true)
43 target_include_directories(keyd SYSTEM PUBLIC
44 ${SYSTEMD_INCLUDE_DIRS})
45 target_link_libraries(keyd ${SYSTEMD_LIBRARIES})
48 install(TARGETS keydctl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
49 install(TARGETS keyd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
50 install(FILES keyd.8 keydctl.8
51 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/)
54 if (DBTYPE STREQUAL "dynamic")
55 foreach(BACKEND IN LISTS BACKENDS)
56 add_library(keydb_${BACKEND} SHARED keydb_${BACKEND}.c)
57 target_include_directories(keydb_${BACKEND} SYSTEM PUBLIC
58 ${BACKEND_${BACKEND}_INC})
59 target_link_libraries(keydb_${BACKEND} libonak
60 ${BACKEND_${BACKEND}_LIBS})
61 install(TARGETS keydb_${BACKEND} LIBRARY DESTINATION
62 ${CMAKE_INSTALL_LIBDIR}/onak/backends/)