diff options
author | Craig Earls <enderw88@gmail.com> | 2013-01-14 21:56:33 -0800 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-01-14 21:56:33 -0800 |
commit | 856f4b673c7cd8235c5647ebad86b1a5fb25739b (patch) | |
tree | ca367d1a79e2ce983e218d23c3d14466825b9a94 /doc/CMakeLists.txt | |
parent | 67a598f6ff3b9b19b08af108c8bfe26064728457 (diff) | |
parent | d4df36a5983ee5ee8ee56c14f3decdcad6faf8af (diff) | |
download | fork-ledger-856f4b673c7cd8235c5647ebad86b1a5fb25739b.tar.gz fork-ledger-856f4b673c7cd8235c5647ebad86b1a5fb25739b.tar.bz2 fork-ledger-856f4b673c7cd8235c5647ebad86b1a5fb25739b.zip |
Merge remote-tracking branch 'upstream/next' into next
Diffstat (limited to 'doc/CMakeLists.txt')
-rw-r--r-- | doc/CMakeLists.txt | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index e69de29b..54c58737 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -0,0 +1,89 @@ +if (USE_DOXYGEN) + find_package(Doxygen) + if(NOT DOXYGEN_FOUND) + message(FATAL_ERROR "Could not find doxygen. Reference documentation cannot be built.") + endif() + + configure_file(Doxyfile.in Doxyfile @ONLY) + add_custom_target(doxygen ALL + COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile + SOURCES Doxyfile) +endif(USE_DOXYGEN) + +######################################################################## + +if(NOT BUILD_DOCS) + return() +endif() + +set(info_files ledger.texi ledger3.texi) + +find_program(MAKEINFO makeinfo) +find_program(TEXI2PDF texi2pdf) +find_program(MAN2HTML man2html) + +######################################################################## + +foreach(file ${info_files}) + get_filename_component(file_base ${file} NAME_WE) + if(BUILD_WEB_DOCS) + if(NOT MAKEINFO) + message(FATAL_ERROR "Could not find makeinfo. HTML version of documentation cannot be built.") + endif() + + add_custom_command(OUTPUT ${file_base}.html + COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${CMAKE_CURRENT_SOURCE_DIR}/${file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + VERBATIM) + list(APPEND ledger_doc_files ${file_base}.html) + endif(BUILD_WEB_DOCS) + + if(NOT TEXI2PDF) + mesage(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.") + else() + add_custom_command(OUTPUT ${file_base}.pdf + COMMAND texi2pdf -b -q --tidy -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + VERBATIM) + list(APPEND ledger_doc_files ${file_base}.pdf) + endif() +endforeach() + +######################################################################## + +if(BUILD_WEB_DOCS) + include(FindUnixCommands) + 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.") + endif() + + add_custom_command(OUTPUT ledger.1.html + COMMAND ${BASH} -c "man2html $<1: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) + +######################################################################## + +add_custom_target(doc ALL DEPENDS ${ledger_doc_files}) + +######################################################################## + +include(GNUInstallDirs) + +if(CMAKE_INSTALL_MANDIR) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) +endif(CMAKE_INSTALL_MANDIR) + +if(CMAKE_INSTALL_DOCDIR) + foreach(file ${info_files}) + get_filename_component(file_base ${file} NAME_WE) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file_base}.pdf + DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL) + endforeach() +endif(CMAKE_INSTALL_DOCDIR) |