Integración con sistemas de construcción CMake

Ahroa, GTK-Doc proporciona un módulo GtkDocConfig.cmake (y el correspondiente módulo GtkDocConfigVersion.cmake). Esto proporciona un comando gtk_doc_add_module que puede configurar en su archivo CMakeLists.txt.

El siguiente ejemplo muestra cómo usar este comando.

Ejemplo 2-8Ejeplo de uso de GTK-Doc desde 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})