forked from telekom/sysrepo-plugin-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: change to a more exhaustive FindLIBSYSTEMD
- Loading branch information
andrej
committed
Aug 3, 2022
1 parent
d47d4c2
commit 627b1c7
Showing
1 changed file
with
40 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
# - Try to find SYSTEMD | ||
# Once done, this will define | ||
# source: https://github.com/FreeRDP/FreeRDP | ||
# Module defines | ||
# LIBSYSTEMD_FOUND - libsystemd libraries and includes found | ||
# LIBSYSTEMD_INCLUDE_DIRS - the libsystemd include directories | ||
# LIBSYSTEMD_LIBRARIES - the libsystemd libraries | ||
# | ||
# SYSTEMD_FOUND - system has SYSTEMD | ||
# SYSTEMD_INCLUDE_DIRS - the SYSTEMD include directories | ||
# SYSTEMD_LIBRARIES - the SYSTEMD library | ||
find_package(PkgConfig) | ||
# Cache entries: | ||
# LIBSYSTEMD_LIBRARY - detected libsystemd library | ||
# LIBSYSTEMD_INCLUDE_DIR - detected libsystemd include dir(s) | ||
# | ||
|
||
if(LIBSYSTEMD_INCLUDE_DIR AND LIBSYSTEMD_LIBRARY) | ||
# in cache already | ||
set(LIBSYSTEMD_FOUND TRUE) | ||
set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY}) | ||
set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR}) | ||
else() | ||
|
||
find_package(PkgConfig) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(_LIBSYSTEMD_PC QUIET "libsystemd") | ||
endif(PKG_CONFIG_FOUND) | ||
|
||
find_path(LIBSYSTEMD_INCLUDE_DIR systemd/sd-journal.h | ||
${_LIBSYSTEMD_PC_INCLUDE_DIRS} | ||
/usr/include | ||
/usr/local/include | ||
) | ||
mark_as_advanced(LIBSYSTEMD_INCLUDE_DIR) | ||
|
||
pkg_check_modules(SYSTEMD_PKGCONF libsystemd) | ||
find_library (LIBSYSTEMD_LIBRARY NAMES systemd | ||
PATHS | ||
${_LIBSYSTEMD_PC_LIBDIR} | ||
) | ||
mark_as_advanced(LIBSYSTEMD_LIBRARY) | ||
|
||
find_path(SYSTEMD_INCLUDE_DIRS | ||
NAMES systemd/sd-bus.h | ||
PATHS ${SYSTEMD_PKGCONF_INCLUDE_DIRS} | ||
) | ||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libsystemd DEFAULT_MSG LIBSYSTEMD_LIBRARY LIBSYSTEMD_INCLUDE_DIR) | ||
|
||
find_library(SYSTEMD_LIBRARIES | ||
NAMES systemd | ||
PATHS ${SYSTEMD_PKGCONF_LIBRARY_DIRS} | ||
) | ||
if(libsystemd_FOUND) | ||
set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY}) | ||
set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR}) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Systemd DEFAULT_MSG SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) | ||
endif() | ||
|
||
mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) |