The open source OpenXR runtime
1#.rst:
2# FindSystemd
3# -------
4#
5# Find Systemd library
6#
7# Try to find Systemd library on UNIX systems. The following values are defined
8#
9# ::
10#
11# SYSTEMD_FOUND - True if Systemd is available
12# SYSTEMD_INCLUDE_DIRS - Include directories for Systemd
13# SYSTEMD_LIBRARIES - List of libraries for Systemd
14# SYSTEMD_DEFINITIONS - List of definitions for Systemd
15#
16#=============================================================================
17# Copyright (c) 2015 Jari Vetoniemi
18# Copyright (c) 2020-2021 Collabora, Ltd.
19#
20# Distributed under the OSI-approved BSD License (the "License");
21# see below.
22#
23# This software is distributed WITHOUT ANY WARRANTY; without even the
24# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25# See the License for more information.
26#
27# SPDX-License-Identifier: BSD-3-Clause
28#=============================================================================
29#
30# Redistribution and use in source and binary forms, with or without
31# modification, are permitted provided that the following conditions
32# are met:
33#
34# * Redistributions of source code must retain the above copyright
35# notice, this list of conditions and the following disclaimer.
36#
37# * Redistributions in binary form must reproduce the above copyright
38# notice, this list of conditions and the following disclaimer in the
39# documentation and/or other materials provided with the distribution.
40#
41# * Neither the names of Kitware, Inc., the Insight Software Consortium,
42# nor the names of their contributors may be used to endorse or promote
43# products derived from this software without specific prior written
44# permission.
45#
46# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57#=============================================================================
58
59include(FeatureSummary)
60set_package_properties(
61 Systemd PROPERTIES
62 URL "http://freedesktop.org/wiki/Software/systemd/"
63 DESCRIPTION "System and Service Manager")
64
65if(NOT ANDROID)
66 find_package(PkgConfig QUIET)
67 if(PKG_CONFIG_FOUND)
68 pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
69 endif()
70endif()
71
72find_library(
73 SYSTEMD_LIBRARY
74 NAMES systemd
75 HINTS ${PC_SYSTEMD_LIBRARY_DIRS})
76find_path(SYSTEMD_INCLUDE_DIR systemd/sd-login.h
77 HINTS ${PC_SYSTEMD_INCLUDE_DIRS})
78
79include(FindPackageHandleStandardArgs)
80find_package_handle_standard_args(Systemd DEFAULT_MSG SYSTEMD_INCLUDE_DIR
81 SYSTEMD_LIBRARY)
82if(SYSTEMD_FOUND)
83 set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY})
84 set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR})
85 set(SYSTEMD_DEFINITIONS ${PC_SYSTEMD_CFLAGS_OTHER})
86endif()