From 53c85ebf1d6e13070fe6871e004e0cff21197ece Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Tue, 25 Feb 2020 22:19:41 -0400 Subject: [PATCH] if(LINUX) doesn't work; just try to find libsystemd gently instead --- CMakeLists.txt | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7913c8cbf..cc0480059 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,19 +226,20 @@ if(JEMALLOC) endif(JEMALLOC) -if (LINUX) -pkg_check_modules(SD libsystemd) -# Default WITH_SYSTEMD to true if we found it -option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND}) +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(SD libsystemd) + # Default WITH_SYSTEMD to true if we found it + option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND}) -if(WITH_SYSTEMD) - if(NOT SD_FOUND) - message(FATAL_ERROR "libsystemd not found") - endif() - add_definitions(-DWITH_SYSTEMD) - include_directories(${SD_INCLUDE_DIRS}) - set(SD_LIBS ${SD_LDFLAGS}) -endif() + if(WITH_SYSTEMD) + if(NOT SD_FOUND) + message(FATAL_ERROR "libsystemd not found") + endif() + add_definitions(-DWITH_SYSTEMD) + include_directories(${SD_INCLUDE_DIRS}) + set(SD_LIBS ${SD_LDFLAGS}) + endif() endif() option(SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON)