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.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 23transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 24include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 25 26function(add_manual_pages _listname) 27 foreach(_file IN LISTS ${_listname}) 28 if(_file STREQUAL "libcurl-symbols.3") 29 # Special case, an auto-generated file. 30 set(_srcfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 31 else() 32 set(_srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}") 33 endif() 34 35 string(REPLACE ".3" ".html" _htmlfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 36 add_custom_command(OUTPUT "${_htmlfile}" 37 COMMAND roffit "--mandir=${CMAKE_CURRENT_SOURCE_DIR}" "${_srcfile}" > "${_htmlfile}" 38 DEPENDS "${_srcfile}" 39 VERBATIM 40 ) 41 42 string(REPLACE ".3" ".pdf" _pdffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 43 string(REPLACE ".3" ".ps" _psfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 44 # XXX any reason why groff -Tpdf (for gropdf) is not used? 45 add_custom_command(OUTPUT "${_pdffile}" 46 COMMAND groff -Tps -man "${_srcfile}" > "${_psfile}" 47 COMMAND ps2pdf "${_psfile}" "${_pdffile}" 48 COMMAND "${CMAKE_COMMAND}" -E remove "${_psfile}" 49 DEPENDS "${_srcfile}" 50 #BYPRODUCTS "${_psfile}" 51 VERBATIM 52 ) 53 # "BYPRODUCTS" for add_custom_command requires CMake 3.2. For now hope that 54 # the temporary files are removed (i.e. the command is not interrupted). 55 endforeach() 56endfunction() 57 58add_custom_command(OUTPUT libcurl-symbols.3 59 COMMAND 60 "${PERL_EXECUTABLE}" 61 "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" < 62 "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.3 63 DEPENDS 64 "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" 65 "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" 66 VERBATIM 67) 68 69add_manual_pages(man_MANS) 70 71string(REPLACE ".3" ".html" HTMLPAGES "${man_MANS}") 72string(REPLACE ".3" ".pdf" PDFPAGES "${man_MANS}") 73add_custom_target(html DEPENDS ${HTMLPAGES}) 74add_custom_target(pdf DEPENDS ${PDFPAGES}) 75 76add_subdirectory(opts) 77