DOC: inconsistent dependencies for documentation build#6550
DOC: inconsistent dependencies for documentation build#6550albert-github wants to merge 3 commits into
Conversation
Handling the addition and removal of example files for the file `Examples.dox` fixes InsightSoftwareConsortium#6545
| add_custom_command( | ||
| OUTPUT | ||
| "${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox" | ||
| Examples.dox | ||
| COMMAND | ||
| ${CMAKE_COMMAND} -D "PROJECT_SOURCE_DIR:PATH=${ITK_SOURCE_DIR}" -D | ||
| "OUTPUT_FILE:PATH=${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox" -P | ||
| "OUTPUT_FILE:PATH=${ITK_EXAMPLES}" -P | ||
| "${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" | ||
| WORKING_DIRECTORY "${ITK_SOURCE_DIR}/Examples" | ||
| #WORKING_DIRECTORY "${ITK_SOURCE_DIR}/Examples" | ||
| WORKING_DIRECTORY ${ITK_BINARY_DIR}/Documentation/Doxygen | ||
| DEPENDS | ||
| "${ITK_SOURCE_DIR}/Examples" | ||
| ${EXAMPLES_LIST} | ||
| "${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" | ||
| ) | ||
| set_source_files_properties(${ITK_EXAMPLES} PROPERTIES GENERATED 1) | ||
| add_custom_target( | ||
| ITKDoxygenExamplesDox | ||
| ITKDoxygenExamplesDox | ||
| ALL | ||
| DEPENDS | ||
| "${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox" | ||
| Examples.dox | ||
| ) |
There was a problem hiding this comment.
Match generated output
OUTPUT Examples.dox and the target dependency are relative to this CMake directory’s binary tree, but the script writes to ${ITK_EXAMPLES} under Documentation/Doxygen. With Ninja/Make, the declared output is never produced, so the custom command remains out of date or fails after generation even though the intended file exists.
There was a problem hiding this comment.
@albert-github Can you please address this greptile concern?
There was a problem hiding this comment.
I will look into it, but it will take a bit over a week before I have time to really look into it (and I don't have ninja).
There was a problem hiding this comment.
Greptile is right, and I confirmed with a minimal Ninja reproduction that this fails on a fresh build tree. Two problems:
- A relative
OUTPUT Examples.doxresolves to${ITK_BINARY_DIR}/Utilities/Doxygen/Examples.dox(this directory's binary dir), while the script writes to${ITK_EXAMPLES}underDocumentation/Doxygen— so the declared output is never produced. - Ninja does not create
WORKING_DIRECTORY, socd .../Documentation/Doxygenfails before the script even runs. SinceGenerateExamplesDox.cmakeuses only absolute paths, theWORKING_DIRECTORYcan be dropped entirely.
Suggested replacement (verified to build and be a no-op on rebuild with Ninja):
add_custom_command(
OUTPUT
${ITK_EXAMPLES}
COMMAND
${CMAKE_COMMAND} -D "PROJECT_SOURCE_DIR:PATH=${ITK_SOURCE_DIR}" -D
"OUTPUT_FILE:PATH=${ITK_EXAMPLES}" -P
"${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake"
DEPENDS
${EXAMPLES_LIST}
"${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake"
)
add_custom_target(ITKDoxygenExamplesDox ALL DEPENDS ${ITK_EXAMPLES})The set_source_files_properties(... GENERATED 1) block can also be removed — add_custom_command outputs are automatically marked GENERATED — and please delete the commented-out #WORKING_DIRECTORY line rather than keeping it.
Fixing pre-commit hook failure.
Fixing pre-commit hook failure.
Handling the addition and removal of example files for the file
Examples.doxfixes #6545
PR Checklist