1 # Load man_MANS from shared file 2 transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 3 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 4 5 function(add_manual_pages _listname) 6 foreach(_file IN LISTS ${_listname}) 7 if(_file STREQUAL "libcurl-symbols.3") 8 # Special case, an auto-generated file. 9 set(_srcfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 10 else() 11 set(_srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}") 12 endif() 13 14 string(REPLACE ".3" ".html" _htmlfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 15 add_custom_command(OUTPUT "${_htmlfile}" 16 COMMAND roffit "--mandir=${CMAKE_CURRENT_SOURCE_DIR}" "${_srcfile}" > "${_htmlfile}" 17 DEPENDS "${_srcfile}" 18 VERBATIM 19 ) 20 21 string(REPLACE ".3" ".pdf" _pdffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 22 string(REPLACE ".3" ".ps" _psfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}") 23 # XXX any reason why groff -Tpdf (for gropdf) is not used? 24 add_custom_command(OUTPUT "${_pdffile}" 25 COMMAND groff -Tps -man "${_srcfile}" > "${_psfile}" 26 COMMAND ps2pdf "${_psfile}" "${_pdffile}" 27 COMMAND "${CMAKE_COMMAND}" -E remove "${_psfile}" 28 DEPENDS "${_srcfile}" 29 #BYPRODUCTS "${_psfile}" 30 VERBATIM 31 ) 32 # "BYPRODUCTS" for add_custom_command requires CMake 3.2. For now hope that 33 # the temporary files are removed (i.e. the command is not interrupted). 34 endforeach() 35 endfunction() 36 37 add_custom_command(OUTPUT libcurl-symbols.3 38 COMMAND 39 "${PERL_EXECUTABLE}" 40 "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" < 41 "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.3 42 DEPENDS 43 "${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" 44 "${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" 45 VERBATIM 46 ) 47 48 add_manual_pages(man_MANS) 49 50 string(REPLACE ".3" ".html" HTMLPAGES "${man_MANS}") 51 string(REPLACE ".3" ".pdf" PDFPAGES "${man_MANS}") 52 add_custom_target(html DEPENDS ${HTMLPAGES}) 53 add_custom_target(pdf DEPENDS ${PDFPAGES}) 54 55 add_subdirectory(opts) 56