You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. cmake_minimum_required(VERSION 2.8)
  2. project(postsrsd C)
  3. find_program(HELP2MAN help2man DOC "path to help2man executable")
  4. find_program(DD dd DOC "path to dd executable")
  5. find_program(BASE64 base64 DOC "path to base64 executable")
  6. find_program(INSSERV insserv DOC "path to insserv executable")
  7. if(NOT DEFINED INIT_FLAVOR)
  8. if(IS_DIRECTORY "/etc/init" AND EXISTS "/lib/init/upstart-job")
  9. message(STATUS "Detected init flavor: upstart")
  10. set(INIT_FLAVOR "upstart" CACHE STRING "Init daemon of this system")
  11. elseif(IS_DIRECTORY "/etc/init.d")
  12. message(STATUS "Detected init flavor: sysv")
  13. set(INIT_FLAVOR "sysv" CACHE STRING "Init daemon of this system")
  14. else()
  15. message(STATUS "Detected init flavor: none")
  16. message(STATUS "System startup files will not be installed")
  17. set(INIT_FLAVOR "" CACHE STRING "Init daemon of this system")
  18. endif()
  19. endif()
  20. add_executable(${PROJECT_NAME} postsrsd.c sha1.c srs2.c)
  21. get_target_property(POSTSRSD ${PROJECT_NAME} LOCATION)
  22. get_filename_component(POSTSRSD ${POSTSRSD} NAME_WE)
  23. configure_file(${PROJECT_NAME}.init.in ${PROJECT_NAME}.init @ONLY)
  24. configure_file(${PROJECT_NAME}.upstart.in ${PROJECT_NAME}.upstart @ONLY)
  25. configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
  26. if(HELP2MAN)
  27. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  28. COMMAND ${HELP2MAN} ARGS -s8 -o${PROJECT_NAME}.8 -N -h-h -v-v ${CMAKE_CURRENT_BINARY_DIR}/${POSTSRSD}
  29. VERBATIM
  30. )
  31. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.8 DESTINATION "share/man/man8")
  32. endif()
  33. install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
  34. install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
  35. install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")