include(Documentation)
-file(GLOB_RECURSE debiandoc-apt guide*.dbk offline*.dbk)
-file(GLOB_RECURSE debiandoc-libapt cache*.dbk design*.dbk dpkg-tech*.dbk
- files*.dbk method*.dbk)
+set(LINGUAS
+ de
+ es
+ fr
+ it
+ ja
+ nl
+ pl
+ pt_BR
+ pt
+)
+set(ENTITIES
+ apt.ent
+ apt-verbatim.ent
+ ../vendor/${CURRENT_VENDOR}/apt-vendor.ent
+)
-set(manpages apt.8 apt-cache.8 apt-get.8 apt-cdrom.8 apt.conf.5 sources.list.5
- apt-config.8 apt_preferences.5 apt-sortpkgs.1 apt-ftparchive.1
- apt-extracttemplates.1 apt-key.8 apt-secure.8 apt-mark.8)
+if(WITH_DOC)
+add_docbook(apt-doc HTML TEXT ALL
+ DOCUMENTS
+ guide.dbk
+ offline.dbk
+ INSTALL ${CMAKE_INSTALL_DOCDIR}/../apt-doc
+ LINGUAS ${LINGUAS}
+ DEPENDS ${ENTITIES}
+)
+
+add_docbook(libapt-pkg-doc HTML TEXT ALL
+ DOCUMENTS
+ design.dbk
+ dpkg-tech.dbk
+ files.dbk
+ method.dbk
+ INSTALL ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc
+ LINGUAS ${LINGUAS}
+ DEPENDS ${ENTITIES}
+)
+
+find_package(Doxygen REQUIRED)
+
+file(GLOB_RECURSE apt_pkg "../apt-pkg/*.h" "../apt-pkg/*.cc")
+configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp
+ DEPENDS ${apt_pkg} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+)
+
+add_custom_target(apt-doxygen ALL
+ DEPENDS ${PROJECT_BINARY_DIR}/doc/doxygen.stamp
+)
+
+install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/doxygen/html
+ DESTINATION ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc
+ PATTERN "*.map" EXCLUDE
+ PATTERN "*.md5" EXCLUDE
+)
-if (WITH_DOC)
-add_docbook(debiandoc-apt "${debiandoc-apt}" share/doc/apt-doc)
-add_docbook(debiandoc-libapt "${debiandoc-libapt}" share/doc/libapt-pkg-doc)
endif()
-# Build the manpages, and add translations (ja only for now, others broken)
-add_xml_manpages(doc-man "${manpages}" "de;es;fr;it;ja;nl;pl;pt_BR;pt" "apt.ent;apt-verbatim.ent")
+add_docbook(apt-man MANPAGE ALL
+ DOCUMENTS
+ apt.8.xml
+ apt-cache.8.xml
+ apt-cdrom.8.xml
+ apt.conf.5.xml
+ apt-config.8.xml
+ apt-extracttemplates.1.xml
+ apt-ftparchive.1.xml
+ apt-get.8.xml
+ apt-key.8.xml
+ apt-mark.8.xml
+ apt_preferences.5.xml
+ apt-secure.8.xml
+ apt-sortpkgs.1.xml
+ sources.list.5.xml
+ DEPENDS ${ENTITIES}
+ LINGUAS ${LINGUAS}
+)
+add_update_po4a(update-po4a po/${PROJECT_NAME}-doc.pot "po/header.pot.txt")
add_subdirectory(examples)