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 2.0KB

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