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