xref: /aosp_15_r20/external/libwebsockets/lib/event-libs/sdevent/CMakeLists.txt (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1# The strategy is to only export to PARENT_SCOPE
2#
3#  - changes to LIB_LIST
4#  - includes via include_directories
5#
6# and keep everything else private
7
8include_directories(.)
9
10# configure or find systemd library
11set(LIB_SYSTEMD_LIBRARIES CACHE PATH "Path to the libsystemd library")
12if ("${LWS_SYSTEMD_LIBRARIES}" STREQUAL "")
13    if (NOT LIB_SYSTEMD_FOUND)
14        find_path(LIBSYSTEMD_INCLUDE_DIRS NAMES systemd/sd-event.h)
15        find_library(LIBSYSTEMD_LIBRARIES NAMES systemd)
16    endif()
17else()
18    set(LIBSYSTEMD_LIBRARIES ${LWS_SYSTEMD_LIBRARIES})
19    set(LIBSYSTEMD_INCLUDE_DIRS ${LWS_LIBSYSTEMD_INCLUDE_DIRS})
20endif()
21message("libsystemd include dir: ${LIBSYSTEMD_INCLUDE_DIRS}")
22message("libsystemd libraries: ${LIBSYSTEMD_LIBRARIES}")
23
24if (LWS_WITH_EVLIB_PLUGINS)
25
26    create_evlib_plugin(
27            evlib_sd
28            sdevent.c
29            private-lib-event-libs-sdevent.h
30            ${LIBSYSTEMD_LIBRARIES}
31    )
32
33else()
34
35    list(APPEND LIB_LIST ${LIBSYSTEMD_LIBRARIES})
36    list(APPEND SOURCES event-libs/sdevent/sdevent.c)
37
38endif()
39
40#
41# Keep explicit parent scope exports at end
42#
43
44exports_to_parent_scope()
45