doc: try to use groff if man2html is not found

to generate a html version of the manpage,
throw a fatal error otherwise.
This commit is contained in:
Alexis Hildebrandt 2014-04-27 11:06:02 +02:00
parent 0e496b4f9b
commit e167cbb647

View file

@ -37,6 +37,7 @@ set(info_files ledger3.texi ledger-mode.texi)
find_program(MAKEINFO makeinfo)
find_program(TEXI2PDF texi2pdf)
find_program(MAN2HTML man2html)
find_program(GROFF groff)
########################################################################
@ -72,15 +73,21 @@ if(BUILD_WEB_DOCS)
if(NOT BASH)
message(FATAL_ERROR "Could not find bash. Unable to build documentation.")
endif()
if(NOT MAN2HTML)
message(FATAL_ERROR "Could not find man2html. HTML version of man page cannot be built.")
if(MAN2HTML)
add_custom_command(OUTPUT ledger.1.html
COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
VERBATIM)
list(APPEND ledger_doc_files ledger.1.html)
elseif(GROFF)
add_custom_command(OUTPUT ledger.1.html
COMMAND ${BASH} -c "groff -mandoc -Thtml ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.html"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
VERBATIM)
list(APPEND ledger_doc_files ledger.1.html)
else()
message(FATAL_ERROR "Could not find man2html or groff. HTML version of man page cannot be built.")
endif()
add_custom_command(OUTPUT ledger.1.html
COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
VERBATIM)
list(APPEND ledger_doc_files ledger.1.html)
endif(BUILD_WEB_DOCS)
########################################################################