File: FindSystemd.cmake

package info (click to toggle)
fcitx5 5.1.18-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 32,228 kB
  • sloc: cpp: 110,377; java: 3,125; javascript: 2,137; sh: 1,912; xml: 1,552; python: 1,312; ansic: 843; makefile: 11
file content (44 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
find_package(PkgConfig)

pkg_check_modules(PKG_SYSTEMD QUIET systemd)

set(SYSTEMD_DEFINITIONS ${PKG_SYSTEMD_CFLAGS_OTHER})
set(SYSTEMD_VERSION ${PKG_SYSTEMD_VERSION})

find_path(SYSTEMD_INCLUDE_DIR
    NAMES systemd/sd-bus.h systemd/sd-event.h
    HINTS ${PKG_SYSTEMD_INCLUDE_DIRS}
)

find_library(SYSTEMD_LIBRARY
    NAMES systemd
    HINTS ${PKG_SYSTEMD_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Systemd
    FOUND_VAR
        SYSTEMD_FOUND
    REQUIRED_VARS
        SYSTEMD_LIBRARY
        SYSTEMD_INCLUDE_DIR
    VERSION_VAR
        SYSTEMD_VERSION
)

if(SYSTEMD_FOUND AND NOT TARGET Systemd::Systemd)
    add_library(Systemd::Systemd UNKNOWN IMPORTED)
    set_target_properties(Systemd::Systemd PROPERTIES
        IMPORTED_LOCATION "${SYSTEMD_LIBRARY}"
        INTERFACE_COMPILE_OPTIONS "${SYSTEMD_DEFINITIONS}"
        INTERFACE_INCLUDE_DIRECTORIES "${SYSTEMD_INCLUDE_DIR}"
    )
endif()

mark_as_advanced(SYSTEMD_INCLUDE_DIR SYSTEMD_ARCH_INCLUDE_DIR SYSTEMD_LIBRARY)

include(FeatureSummary)
set_package_properties(Systemd PROPERTIES
    URL "http://www.freedesktop.org/wiki/Software/systemd"
    DESCRIPTION "A system and service manager for Linux"
)