CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. unset(_rofffiles)
  29. unset(_mdfiles)
  30. foreach(_file IN LISTS ${_listname})
  31. list(APPEND _rofffiles "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  32. if(_file STREQUAL "libcurl-symbols.3")
  33. # Special case, an auto-generated file.
  34. string(REPLACE ".3" ".md" _mdfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
  35. else()
  36. string(REPLACE ".3" ".md" _mdfile "${_file}")
  37. endif()
  38. list(APPEND _mdfiles "${_mdfile}")
  39. endforeach()
  40. add_custom_command(OUTPUT ${_rofffiles}
  41. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  42. COMMAND ${PROJECT_SOURCE_DIR}/scripts/cd2nroff -k -d "${CMAKE_CURRENT_BINARY_DIR}" ${_mdfiles}
  43. DEPENDS ${_mdfiles}
  44. VERBATIM
  45. )
  46. endfunction()
  47. add_custom_command(OUTPUT libcurl-symbols.md
  48. COMMAND
  49. "${PERL_EXECUTABLE}"
  50. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
  51. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.md
  52. DEPENDS
  53. "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
  54. "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
  55. VERBATIM
  56. )
  57. add_manual_pages(man_MANS)
  58. add_custom_target(man ALL DEPENDS ${man_MANS})
  59. if(NOT CURL_DISABLE_INSTALL)
  60. unset(_src)
  61. foreach(_f ${man_MANS})
  62. list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
  63. endforeach()
  64. install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
  65. endif()
  66. add_subdirectory(opts)