fix cmake systemd header detection

This commit is contained in:
Vaxry 2023-01-11 17:41:03 +01:00
parent 7afb7c85a7
commit 8ba4f34a7c

View file

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.4) cmake_minimum_required(VERSION 3.4)
include(CheckIncludeFile)
# Get version # Get version
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
@ -85,12 +86,13 @@ IF(NO_SYSTEMD MATCHES true)
ELSE() ELSE()
message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined) checking deps...") message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined) checking deps...")
pkg_check_modules(LIBSYSTEMD libsystemd) pkg_check_modules(LIBSYSTEMD libsystemd)
IF(LIBSYSTEMD_FOUND) check_include_file("systemd/sd-daemon.h" SYSTEMDH)
IF(LIBSYSTEMD_FOUND AND SYSTEMDH)
add_definitions( -DUSES_SYSTEMD ) add_definitions( -DUSES_SYSTEMD )
target_link_libraries(Hyprland "${LIBSYSTEMD_LIBRARIES}") target_link_libraries(Hyprland "${LIBSYSTEMD_LIBRARIES}")
ELSE() ELSE()
message(WARNING "Systemd support requested but libsystemd was not found") message(WARNING "Systemd support requested but libsystemd or systemd headers were not found")
ENDIF(LIBSYSTEMD_FOUND) ENDIF(LIBSYSTEMD_FOUND AND SYSTEMDH)
ENDIF(NO_SYSTEMD MATCHES true) ENDIF(NO_SYSTEMD MATCHES true)
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"") target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")