mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-26 04:09:35 +03:00
Teach `doxygen_add_docs()` to recursively create subdirectories for each output format (HTML, XML, ...) and add each subdirectory to the `clean` target. Previously, only the HTML output directory was added to the `clean` target. Fixes: #27970, #22570
49 lines
1.4 KiB
CMake
49 lines
1.4 KiB
CMake
|
|
message(STATUS "Checking whether Doxygen wrote "
|
|
"output to expected directories...")
|
|
|
|
foreach(DIR IN LISTS OUTPUT_DIRS)
|
|
file(GLOB DIR_CONTENTS "${DIR}/*")
|
|
|
|
list(LENGTH DIR_CONTENTS DIR_SIZE)
|
|
|
|
if(DIR_SIZE EQUAL 0)
|
|
message(FATAL_ERROR "Target directory \"${DIR}\" is empty. "
|
|
"Doxygen failed to generate output.")
|
|
else()
|
|
message(STATUS "Target directory \"${DIR}\" is not empty. "
|
|
"Doxygen generated output.")
|
|
endif()
|
|
endforeach()
|
|
|
|
message(STATUS "Building 'clean' target...")
|
|
|
|
execute_process(
|
|
COMMAND ${CMAKE_COMMAND} --build ${BUILD_DIR} --target clean
|
|
RESULT_VARIABLE CLEAN_RESULT
|
|
ERROR_QUIET
|
|
)
|
|
|
|
if(NOT CLEAN_RESULT EQUAL 0)
|
|
message(FATAL_ERROR "The 'clean' target failed to build")
|
|
endif()
|
|
|
|
message(STATUS "Successfully built 'clean' target")
|
|
|
|
message(STATUS "Checking whether the 'clean' target "
|
|
"successfully cleaned the Doxygen output...")
|
|
|
|
foreach(DIR IN LISTS OUTPUT_DIRS)
|
|
file(GLOB DIR_CONTENTS "${DIR}/*")
|
|
|
|
list(LENGTH DIR_CONTENTS DIR_SIZE)
|
|
|
|
if(DIR_SIZE EQUAL 0)
|
|
message(STATUS "Target directory \"${DIR}\" is empty. "
|
|
"The 'clean' target succeeded.")
|
|
else()
|
|
message(FATAL_ERROR "Target directory \"${DIR}\" is not empty. "
|
|
"The 'clean' target failed.")
|
|
endif()
|
|
endforeach()
|