Merge pull request #120 from kljohann/cmake.docs

fix issue for separate build dir
This commit is contained in:
John Wiegley 2013-01-14 14:04:00 -08:00
commit 3af432d330

View file

@ -14,8 +14,8 @@ foreach(file ${info_files})
endif() endif()
add_custom_command(OUTPUT ${file_base}.html add_custom_command(OUTPUT ${file_base}.html
COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${file} COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${CMAKE_CURRENT_SOURCE_DIR}/${file}
DEPENDS ${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
VERBATIM) VERBATIM)
list(APPEND ledger_doc_files ${file_base}.html) list(APPEND ledger_doc_files ${file_base}.html)
endif(BUILD_WEB_DOCS) endif(BUILD_WEB_DOCS)
@ -23,11 +23,9 @@ foreach(file ${info_files})
if(NOT TEXI2PDF) if(NOT TEXI2PDF)
mesage(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.") mesage(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.")
else() else()
get_filename_component(file_base ${file} NAME_WE)
add_custom_command(OUTPUT ${file_base}.pdf add_custom_command(OUTPUT ${file_base}.pdf
COMMAND texi2pdf -b -q ${file} COMMAND texi2pdf -b -q --tidy -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file}
COMMAND rm -f ${file_base}.aux ${file_base}.cp ${file_base}.fn ${file_base}.ky ${file_base}.log ${file_base}.pg ${file_base}.toc ${file_base}.tp ${file_base}.vr DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
DEPENDS ${file}
VERBATIM) VERBATIM)
list(APPEND ledger_doc_files ${file_base}.pdf) list(APPEND ledger_doc_files ${file_base}.pdf)
endif() endif()
@ -45,8 +43,8 @@ if(BUILD_WEB_DOCS)
endif() endif()
add_custom_command(OUTPUT ledger.1.html add_custom_command(OUTPUT ledger.1.html
COMMAND ${BASH} -c "man2html ledger.1 | tail -n+3 > ledger.1.html" COMMAND ${BASH} -c "man2html $<1:CMAKE_CURRENT_SOURCE_DIR>/ledger.1 | tail -n+3 > ledger.1.html"
DEPENDS ledger.1 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
VERBATIM) VERBATIM)
list(APPEND ledger_doc_files ledger.1.html) list(APPEND ledger_doc_files ledger.1.html)
endif(BUILD_WEB_DOCS) endif(BUILD_WEB_DOCS)
@ -60,14 +58,14 @@ add_custom_target(doc ALL DEPENDS ${ledger_doc_files})
include(GNUInstallDirs) include(GNUInstallDirs)
if(CMAKE_INSTALL_MANDIR) if(CMAKE_INSTALL_MANDIR)
install(FILES ledger.1 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
endif(CMAKE_INSTALL_MANDIR) endif(CMAKE_INSTALL_MANDIR)
if(CMAKE_INSTALL_DOCDIR) if(CMAKE_INSTALL_DOCDIR)
foreach(file ${info_files}) foreach(file ${info_files})
get_filename_component(file_base ${file} NAME_WE) get_filename_component(file_base ${file} NAME_WE)
install(FILES ${file_base}.pdf install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file_base}.pdf
DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL) DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL)
endforeach() endforeach()
endif(CMAKE_INSTALL_DOCDIR) endif(CMAKE_INSTALL_DOCDIR)