From 76ee7475c09ecb46586800251c30cdf2dec90f6b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 24 Jan 2024 09:07:57 +0100 Subject: [PATCH] Make systemd detection more robust We don't need to look for this on Windows or macOS, and we need to be able to gracefully handle systems without pkg-config. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6028fadf..f1bfd618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,7 +302,12 @@ if(UNIX AND NOT APPLE) endif() # check for systemd support (socket activation) -pkg_check_modules(LIBSYSTEMD libsystemd) +if(UNIX AND NOT APPLE) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(LIBSYSTEMD libsystemd) + endif() +endif() # Generate config.h and make sure the source finds it configure_file(config.h.in config.h) -- 2.39.5