diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index 0d620cded3f..287870893c1 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -162,31 +162,43 @@ if(ITK_BUILD_DOCUMENTATION) find_package(LATEX) + file( + GLOB_RECURSE EXAMPLES_LIST + CONFIGURE_DEPENDS + "${ITK_SOURCE_DIR}/Examples/*.cxx" + "${ITK_SOURCE_DIR}/Examples/*.py" + "${ITK_SOURCE_DIR}/Examples/*.java" + ) + set(ITK_EXAMPLES ${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox) + # Custom command to generate a examples page which include all ITK examples 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" ) - add_custom_target( - ITKDoxygenExamplesDox - DEPENDS - "${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox" + set_source_files_properties( + ${ITK_EXAMPLES} + PROPERTIES + GENERATED + 1 ) + add_custom_target(ITKDoxygenExamplesDox ALL DEPENDS Examples.dox) set( ITK_DOXYGEN_INPUT ${DOXYGEN_INCLUDE_DIRS} ${ITK_SOURCE_DIR}/Documentation/Doxygen ${ITK_BINARY_DIR}/Documentation/Doxygen - ${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox + ${ITK_EXAMPLES} ${ITK_BINARY_DIR}/Utilities/Doxygen/Modules ${ITK_DOXYGEN_INPUT} )