2014-12-01 19:55:22 +00:00
|
|
|
project(trdaemon)
|
|
|
|
|
|
|
|
if(WITH_SYSTEMD)
|
2016-04-23 16:13:25 +00:00
|
|
|
add_definitions(-DUSE_SYSTEMD)
|
2014-12-01 19:55:22 +00:00
|
|
|
endif()
|
|
|
|
|
2021-09-21 23:03:39 +00:00
|
|
|
add_compile_options(${CXX_WARNING_FLAGS})
|
|
|
|
|
2014-12-01 19:55:22 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}
|
2020-08-11 18:11:55 +00:00
|
|
|
)
|
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
2014-12-02 20:42:33 +00:00
|
|
|
${CURL_INCLUDE_DIRS}
|
2014-12-01 19:55:22 +00:00
|
|
|
${EVENT2_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2015-04-04 17:43:56 +00:00
|
|
|
set(${PROJECT_NAME}_SOURCES
|
2021-09-21 23:03:39 +00:00
|
|
|
daemon.cc
|
|
|
|
daemon-posix.cc
|
|
|
|
daemon-win32.cc
|
2015-04-04 17:43:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
2021-09-21 23:03:39 +00:00
|
|
|
set_source_files_properties(daemon-posix.cc PROPERTIES HEADER_FILE_ONLY ON)
|
2015-04-04 17:43:56 +00:00
|
|
|
else()
|
2021-09-21 23:03:39 +00:00
|
|
|
set_source_files_properties(daemon-win32.cc PROPERTIES HEADER_FILE_ONLY ON)
|
2015-04-04 17:43:56 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${PROJECT_NAME}_HEADERS
|
|
|
|
daemon.h
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
2015-04-14 22:46:40 +00:00
|
|
|
tr_win32_app_info(${PROJECT_NAME}_WIN32_RC_FILE
|
|
|
|
"Transmission Daemon"
|
|
|
|
"${TR_NAME}-daemon"
|
|
|
|
"${TR_NAME}-daemon.exe")
|
|
|
|
|
|
|
|
add_executable(${TR_NAME}-daemon
|
|
|
|
${${PROJECT_NAME}_SOURCES}
|
|
|
|
${${PROJECT_NAME}_HEADERS}
|
|
|
|
${${PROJECT_NAME}_WIN32_RC_FILE})
|
2015-04-04 17:43:56 +00:00
|
|
|
|
2014-12-01 19:55:22 +00:00
|
|
|
target_link_libraries(${TR_NAME}-daemon
|
|
|
|
${TR_NAME}
|
|
|
|
${EVENT2_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2016-12-19 02:53:19 +00:00
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
target_include_directories(${TR_NAME}-daemon PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(${TR_NAME}-daemon ${SYSTEMD_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2018-11-06 20:06:10 +00:00
|
|
|
foreach(P daemon)
|
2014-12-01 19:55:22 +00:00
|
|
|
install(TARGETS ${TR_NAME}-${P} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
|
|
|
|
if(INSTALL_DOC)
|
|
|
|
install(FILES ${TR_NAME}-${P}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|
|
|
endif()
|
|
|
|
endforeach()
|