CMakeLists.txt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Load man_MANS from shared file
  2. transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  3. include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  4. function(add_manual_pages _listname)
  5. foreach(_file IN LISTS ${_listname})
  6. if(_file STREQUAL "libcurl-symbols.3")
  7. # Special case, an auto-generated file.
  8. set(_srcfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  9. else()
  10. set(_srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
  11. endif()
  12. string(REPLACE ".3" ".html" _htmlfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  13. add_custom_command(OUTPUT "${_htmlfile}"
  14. COMMAND roffit "--mandir=${CMAKE_CURRENT_SOURCE_DIR}" "${_srcfile}" > "${_htmlfile}"
  15. DEPENDS "${_srcfile}"
  16. VERBATIM
  17. )
  18. string(REPLACE ".3" ".pdf" _pdffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  19. string(REPLACE ".3" ".ps" _psfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  20. # XXX any reason why groff -Tpdf (for gropdf) is not used?
  21. add_custom_command(OUTPUT "${_pdffile}"
  22. COMMAND groff -Tps -man "${_srcfile}" > "${_psfile}"
  23. COMMAND ps2pdf "${_psfile}" "${_pdffile}"
  24. COMMAND "${CMAKE_COMMAND}" -E remove "${_psfile}"
  25. DEPENDS "${_srcfile}"
  26. #BYPRODUCTS "${_psfile}"
  27. VERBATIM
  28. )
  29. # "BYPRODUCTS" for add_custom_command requires CMake 3.2. For now hope that
  30. # the temporary files are removed (i.e. the command is not interrupted).
  31. endforeach()
  32. endfunction()
  33. add_custom_command(OUTPUT libcurl-symbols.3
  34. COMMAND
  35. "${PERL_EXECUTABLE}"
  36. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
  37. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.3
  38. DEPENDS
  39. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
  40. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
  41. VERBATIM
  42. )
  43. add_manual_pages(man_MANS)
  44. string(REPLACE ".3" ".html" HTMLPAGES "${man_MANS}")
  45. string(REPLACE ".3" ".pdf" PDFPAGES "${man_MANS}")
  46. add_custom_target(html DEPENDS ${HTMLPAGES})
  47. add_custom_target(pdf DEPENDS ${PDFPAGES})
  48. add_subdirectory(opts)