CMake: only run ldoc with changed input (#1911)

This adds a custom command to build the documentation, where you can
specify the generated output then. "ldoc" then depends on this output.

This way "ldoc" is not being run every time, but only if the input files
have changed.  ldoc's config is added therefore to the list of
dependencies to make config changes trigger a rebuild.
This commit is contained in:
Daniel Hahler 2017-07-09 18:45:14 +02:00 committed by GitHub
parent 95b412df19
commit fc1ba35366
1 changed files with 6 additions and 2 deletions

View File

@ -294,10 +294,14 @@ if(GENERATE_DOC)
file(COPY ${SOURCE_DIR}/docs/aliases DESTINATION ${BUILD_DIR}/docs) file(COPY ${SOURCE_DIR}/docs/aliases DESTINATION ${BUILD_DIR}/docs)
add_custom_target(ldoc ALL add_custom_target(ldoc ALL
DEPENDS ${BUILD_DIR}/doc/index.html)
add_custom_command(
COMMAND ${LDOC_EXECUTABLE} . COMMAND ${LDOC_EXECUTABLE} .
OUTPUT ${BUILD_DIR}/doc/index.html
WORKING_DIRECTORY ${AWE_DOC_DIR} WORKING_DIRECTORY ${AWE_DOC_DIR}
DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES} DEPENDS ${AWE_LUA_FILES} ${AWE_MD_FILES} ${BUILD_DIR}/docs/config.ld
) COMMENT "Generating API documentation"
VERBATIM)
# Run ldoc and make it fail if any warnings are generated. The # Run ldoc and make it fail if any warnings are generated. The
# redirection-magic swaps stdout and stderr and awk exits with a non-zero # redirection-magic swaps stdout and stderr and awk exits with a non-zero