summaryrefslogtreecommitdiffstats
path: root/fluent-bit/cmake/FindJournald.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /fluent-bit/cmake/FindJournald.cmake
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/cmake/FindJournald.cmake')
-rw-r--r--fluent-bit/cmake/FindJournald.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/fluent-bit/cmake/FindJournald.cmake b/fluent-bit/cmake/FindJournald.cmake
new file mode 100644
index 000000000..9e6657a29
--- /dev/null
+++ b/fluent-bit/cmake/FindJournald.cmake
@@ -0,0 +1,49 @@
+# - Try to find Journald library.
+# Once done this will define
+#
+# JOURNALD_FOUND - system has Journald
+# JOURNALD_INCLUDE_DIR - the Journald include directory
+# JOURNALD_LIBRARIES - Link these to use Journald
+# JOURNALD_DEFINITIONS - Compiler switches required for using Journald
+# SYSTEMD_UNITDIR - The systemd units' directory
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+# Copyright (c) 2015 David Edmundson
+#
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig)
+pkg_check_modules(PC_JOURNALD QUIET systemd)
+pkg_get_variable(PC_SYSTEMD_UNITDIR systemd "systemdsystemunitdir")
+
+set(SYSTEMD_UNITDIR ${PC_SYSTEMD_UNITDIR})
+set(JOURNALD_FOUND ${PC_JOURNALD_FOUND})
+set(JOURNALD_DEFINITIONS ${PC_JOURNALD_CFLAGS_OTHER})
+
+find_path(JOURNALD_INCLUDE_DIR NAMES systemd/sd-journal.h
+ PATHS
+ ${PC_JOURNALD_INCLUDEDIR}
+ ${PC_JOURNALD_INCLUDE_DIRS}
+)
+
+find_library(JOURNALD_LIBRARY NAMES systemd
+ PATHS
+ ${PC_JOURNALD_LIBDIR}
+ ${PC_JOURNALD_LIBRARY_DIRS}
+)
+
+set(JOURNALD_LIBRARIES ${JOURNALD_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Journald DEFAULT_MSG JOURNALD_LIBRARY JOURNALD_INCLUDE_DIR)
+
+include(FeatureSummary)
+set_package_properties(Journald PROPERTIES URL https://github.com/systemd
+ DESCRIPTION "Systemd logging daemon")
+
+# show the JOURNALD_INCLUDE_DIR and JOURNALD_LIBRARY variables only in the advanced view
+mark_as_advanced(JOURNALD_INCLUDE_DIR JOURNALD_LIBRARY)