CMakeLists.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 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.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. # SPDX-License-Identifier: curl
  22. #
  23. ###########################################################################
  24. # Load man_MANS from shared file
  25. transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  26. include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
  27. function(add_manual_pages _listname)
  28. foreach(_file IN LISTS ${_listname})
  29. set(_rofffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  30. if(_file STREQUAL "libcurl-symbols.3")
  31. # Special case, an auto-generated file.
  32. string(REPLACE ".3" ".md" _mdfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  33. else()
  34. string(REPLACE ".3" ".md" _mdfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
  35. endif()
  36. add_custom_command(OUTPUT "${_rofffile}"
  37. COMMAND "${PERL_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/scripts/cd2nroff ${_mdfile} > ${_rofffile}
  38. DEPENDS "${_mdfile}"
  39. VERBATIM
  40. )
  41. endforeach()
  42. endfunction()
  43. add_custom_command(OUTPUT libcurl-symbols.md
  44. COMMAND
  45. "${PERL_EXECUTABLE}"
  46. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
  47. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.md
  48. DEPENDS
  49. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
  50. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
  51. VERBATIM
  52. )
  53. add_manual_pages(man_MANS)
  54. add_custom_target(man ALL DEPENDS ${man_MANS})
  55. if(NOT CURL_DISABLE_INSTALL)
  56. unset(_src)
  57. foreach(_f ${man_MANS})
  58. list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
  59. endforeach()
  60. install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
  61. endif()
  62. add_subdirectory(opts)