2
0

CMakeLists.txt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. ###########################################################################
  22. # Load man_MANS from shared file
  23. transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  24. include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  25. function(add_manual_pages _listname)
  26. foreach(_file IN LISTS ${_listname})
  27. if(_file STREQUAL "libcurl-symbols.3")
  28. # Special case, an auto-generated file.
  29. set(_srcfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  30. else()
  31. set(_srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
  32. endif()
  33. string(REPLACE ".3" ".html" _htmlfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  34. add_custom_command(OUTPUT "${_htmlfile}"
  35. COMMAND roffit "--mandir=${CMAKE_CURRENT_SOURCE_DIR}" "${_srcfile}" > "${_htmlfile}"
  36. DEPENDS "${_srcfile}"
  37. VERBATIM
  38. )
  39. string(REPLACE ".3" ".pdf" _pdffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  40. string(REPLACE ".3" ".ps" _psfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  41. # XXX any reason why groff -Tpdf (for gropdf) is not used?
  42. add_custom_command(OUTPUT "${_pdffile}"
  43. COMMAND groff -Tps -man "${_srcfile}" > "${_psfile}"
  44. COMMAND ps2pdf "${_psfile}" "${_pdffile}"
  45. COMMAND "${CMAKE_COMMAND}" -E remove "${_psfile}"
  46. DEPENDS "${_srcfile}"
  47. #BYPRODUCTS "${_psfile}"
  48. VERBATIM
  49. )
  50. # "BYPRODUCTS" for add_custom_command requires CMake 3.2. For now hope that
  51. # the temporary files are removed (i.e. the command is not interrupted).
  52. endforeach()
  53. endfunction()
  54. add_custom_command(OUTPUT libcurl-symbols.3
  55. COMMAND
  56. "${PERL_EXECUTABLE}"
  57. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
  58. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.3
  59. DEPENDS
  60. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
  61. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
  62. VERBATIM
  63. )
  64. add_manual_pages(man_MANS)
  65. string(REPLACE ".3" ".html" HTMLPAGES "${man_MANS}")
  66. string(REPLACE ".3" ".pdf" PDFPAGES "${man_MANS}")
  67. add_custom_target(html DEPENDS ${HTMLPAGES})
  68. add_custom_target(pdf DEPENDS ${PDFPAGES})
  69. add_subdirectory(opts)