mirror of
https://github.com/transmission/transmission
synced 2025-01-01 12:35:22 +00:00
Merge pull request #118 from floppym/systemd
cmake: add FindSYSTEMD module
This commit is contained in:
commit
f48c0cc130
3 changed files with 26 additions and 9 deletions
|
@ -373,9 +373,7 @@ endif()
|
|||
|
||||
if(WITH_SYSTEMD)
|
||||
tr_get_required_flag(WITH_SYSTEMD SYSTEMD_IS_REQUIRED)
|
||||
|
||||
pkg_check_modules(SYSTEMD ${SYSTEMD_IS_REQUIRED} libsystemd)
|
||||
|
||||
find_package(SYSTEMD)
|
||||
tr_fixup_auto_option(WITH_SYSTEMD SYSTEMD_FOUND SYSTEMD_IS_REQUIRED)
|
||||
endif()
|
||||
|
||||
|
|
20
cmake/FindSYSTEMD.cmake
Normal file
20
cmake/FindSYSTEMD.cmake
Normal file
|
@ -0,0 +1,20 @@
|
|||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
|
||||
endif()
|
||||
|
||||
find_path(SYSTEMD_INCLUDE_DIR NAMES systemd/sd-daemon.h HINTS ${PC_SYSTEMD_INCLUDE_DIRS})
|
||||
find_library(SYSTEMD_LIBRARY NAMES systemd HINTS ${PC_SYSTEMD_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(SYSTEMD
|
||||
REQUIRED_VARS
|
||||
SYSTEMD_LIBRARY
|
||||
SYSTEMD_INCLUDE_DIR
|
||||
)
|
||||
|
||||
mark_as_advanced(SYSTEMD_INCLUDE_DIR SYSTEMD_LIBRARY)
|
||||
|
||||
set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR})
|
||||
set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY})
|
|
@ -36,17 +36,16 @@ add_executable(${TR_NAME}-daemon
|
|||
${${PROJECT_NAME}_HEADERS}
|
||||
${${PROJECT_NAME}_WIN32_RC_FILE})
|
||||
|
||||
set_target_properties(${TR_NAME}-daemon PROPERTIES
|
||||
COMPILE_FLAGS "${SYSTEMD_CFLAGS}"
|
||||
LINK_FLAGS "${SYSTEMD_LDFLAGS}"
|
||||
)
|
||||
|
||||
target_link_libraries(${TR_NAME}-daemon
|
||||
${TR_NAME}
|
||||
${EVENT2_LIBRARIES}
|
||||
${SYSTEMD_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_SYSTEMD)
|
||||
target_include_directories(${TR_NAME}-daemon PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
||||
target_link_libraries(${TR_NAME}-daemon ${SYSTEMD_LIBRARIES})
|
||||
endif()
|
||||
|
||||
tr_win32_app_info(${PROJECT_NAME}_remote_WIN32_RC_FILE
|
||||
"Transmission Utility ('remote')"
|
||||
"${TR_NAME}-remote"
|
||||
|
|
Loading…
Reference in a new issue