Doc is built unconditionally, every time

Bug #1476488 reported by Michi Henning
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cmake-extras (Ubuntu)
Fix Released
Undecided
Pete Woods

Bug Description

Using add_doxygen() like this:

file(GLOB public_headers ${CMAKE_SOURCE_DIR}/include/core/*.h)
add_doxygen(
    ${LIBNAME}-doc
    INPUT
        ${public_headers}
    OUTPUT_DIRECTORY
        ${CMAKE_BINARY_DIR}/doc
    STRIP_FROM_PATH
        "${CMAKE_SOURCE_DIR}/src"
    STRIP_FROM_INC_PATH
        "${CMAKE_SOURCE_DIR}/include"
    EXCLUDE_PATTERNS
        */internal/*
    EXCLUDE_SYMBOLS
        *::internal*
        *::Priv
    ALL
)

With this, the documentation is re-generated every time I build the project, even if Doxyfile.in has not changed, and none of the source files from which the documentation is built have changed.

For large documentation sets, this is quite annoying.

Related branches

Revision history for this message
Michi Henning (michihenning) wrote :

Here is how I used to do this previously:

find_package(Doxygen)
find_program(DOT_EXECUTABLE dot /usr/bin)
if (NOT DOXYGEN_FOUND OR NOT DOT_EXECUTABLE)
    message(WARNING "Cannot generate documentation: doxygen and/or graphviz not found")
else()
    configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY IMMEDIATE)
    add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/lib${LIBNAME}/index.html
                       COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile
                       DEPENDS ${PROJECT_BINARY_DIR}/doc/Doxyfile
                               ${PROJECT_SOURCE_DIR}/include/core/*.h)
    add_custom_target(doc ALL
                       DEPENDS ${PROJECT_BINARY_DIR}/doc/lib${LIBNAME}/index.html)
    install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/lib${LIBNAME}
            DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc)
endif()

Note that add_custom_command has a depends on the generated Doxyfile and the input files, and add_custom_target doesn't depend on Doxyfile, but on the generated index.html file.

Pete Woods (pete-woods)
no longer affects: cmake-extras
Pete Woods (pete-woods)
Changed in cmake-extras (Ubuntu):
status: New → Confirmed
Pete Woods (pete-woods)
Changed in cmake-extras (Ubuntu):
status: Confirmed → In Progress
Pete Woods (pete-woods)
Changed in cmake-extras (Ubuntu):
assignee: nobody → Pete Woods (pete-woods)
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.