CMakeLists.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # If we are building from a release tarball, the man pages should already be built, so them.
  2. # If we are building from git, then the man pages will not be built. In this
  3. # case, attempt to find xsltproc, and if found build the man pages. If xsltproc
  4. # could not be found, then the man pages will not be built or installed -
  5. # because the install is optional.
  6. if(NOT WIN32)
  7. find_program(XSLTPROC xsltproc OPTIONAL)
  8. if(XSLTPROC)
  9. function(compile_manpage page)
  10. add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page}
  11. COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/
  12. MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml)
  13. add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page})
  14. endfunction()
  15. compile_manpage("mosquitto_ctrl.1")
  16. compile_manpage("mosquitto_ctrl_dynsec.1")
  17. compile_manpage("mosquitto_passwd.1")
  18. compile_manpage("mosquitto_pub.1")
  19. compile_manpage("mosquitto_sub.1")
  20. compile_manpage("mosquitto_rr.1")
  21. compile_manpage("libmosquitto.3")
  22. compile_manpage("mosquitto.conf.5")
  23. compile_manpage("mosquitto-tls.7")
  24. compile_manpage("mqtt.7")
  25. compile_manpage("mosquitto.8")
  26. else()
  27. message(FATAL_ERROR "xsltproc not found: manpages cannot be built")
  28. endif()
  29. endif()
  30. install(FILES
  31. mosquitto_ctrl.1
  32. mosquitto_ctrl_dynsec.1
  33. mosquitto_passwd.1
  34. mosquitto_pub.1
  35. mosquitto_sub.1
  36. mosquitto_rr.1
  37. DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
  38. OPTIONAL)
  39. install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL)
  40. install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL)
  41. install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL)
  42. install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL)