Integration in CMake-Erstellungssysteme

GTK-Doc stellt nun ein GtkDocConfig.cmake-Modul (und das korrespondierende GtkDocConfigVersion.cmake-Modul) bereit. Dadurch steht Ihnen der Befehl gtk_doc_add_module zur Verfügung, den Sie in die Datei CMakeLists.txt integrieren können.

Das folgende Beispiel zeigt, wie dieser Befehl eingesetzt wird.

Beispiel 2-8Beispiel zur Verwendung von GTK-Doc mit CMake
find_package(GtkDoc 1.25 REQUIRED)

# Create the doc-libmeep target.
gtk_doc_add_module(
   libmeep ${CMAKE_SOURCE_DIR}/libmeep
      XML meep-docs.xml
      LIBRARIES libmeep
)

# Build doc-libmeep as part of the default target. Without this, you would
# have to explicitly run something like `make doc-libmeep` to build the docs.
add_custom_target(documentation ALL DEPENDS doc-libmeep)

# Install the docs. (This assumes you're using the GNUInstallDirs CMake module
# to set the CMAKE_INSTALL_DOCDIR variable correctly).
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libmeep/html
        DESTINATION ${CMAKE_INSTALL_DOCDIR})