btop/cmake/Modules/FindSystemd.cmake
nobounce a9061dfad2
Add alternative logging backends
This commit allows for btop to log to either syslog(3) or systemd's
journal
2023-11-29 22:20:13 +01:00

26 lines
747 B
CMake

# SPDX-License-Identifier: Apache-2.0
#
# Find systemd
#
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_path(Systemd_INCLUDE_DIR NAMES systemd/sd-journal.h)
find_library(Systemd_LIBRARY NAMES systemd)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Systemd REQUIRED_VARS Systemd_LIBRARY Systemd_INCLUDE_DIR)
if(Systemd_FOUND AND NOT TARGET Systemd::Systemd)
add_library(Systemd::Systemd UNKNOWN IMPORTED)
set_target_properties(Systemd::Systemd PROPERTIES
IMPORTED_LOCATION "${Systemd_LIBRARY}"
)
endif()
if(Systemd_FOUND AND NOT TARGET Systemd::Journald)
add_library(Systemd::Journald ALIAS Systemd::Systemd)
endif()
mark_as_advanced(Systemd_INCLUDE_DIR Systemd_LIBRARY)
endif()