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}")
41 target_include_directories(keyd SYSTEM PUBLIC
42 ${SYSTEMD_INCLUDE_DIRS})
43 target_link_libraries(keyd ${SYSTEMD_LIBRARIES})
46 install(TARGETS keydctl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
47 install(TARGETS keyd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
48 install(FILES keyd.8 keydctl.8
49 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/)
52 if (DBTYPE STREQUAL "dynamic")
53 foreach(BACKEND IN LISTS BACKENDS)
54 add_library(keydb_${BACKEND} SHARED keydb_${BACKEND}.c)
55 target_include_directories(keydb_${BACKEND} SYSTEM PUBLIC
56 ${BACKEND_${BACKEND}_INC})
57 target_link_libraries(keydb_${BACKEND} libonak
58 ${BACKEND_${BACKEND}_LIBS})
59 install(TARGETS keydb_${BACKEND} LIBRARY DESTINATION
60 ${CMAKE_INSTALL_LIBDIR}/onak/backends/)