diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 1747bfb62..dfc2bf9cf 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -34,10 +34,19 @@ message(STATUS "Building API Documentation (mandatory for Python binding or for building the manual)") - set(SPHINX_EXTRA_API ${CMAKE_CURRENT_BINARY_DIR}/manual/extra_html/api) - file(MAKE_DIRECTORY ${SPHINX_EXTRA_API}) - - execute_process(COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT} OUTPUT_QUIET) + execute_process( + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT} + OUTPUT_QUIET + ERROR_VARIABLE DOXYGEN_ERROR + RESULT_VARIABLE DOXYGEN_RESULT + ) + if(NOT DOXYGEN_RESULT EQUAL 0) + if(DOXYGEN_RESULT STREQUAL "Segmentation fault" AND EXISTS "${CMAKE_BINARY_DIR}/doc/api/xml/index.xml") + message(WARNING "Doxygen exited with '${DOXYGEN_RESULT}' but generated XML output. Continuing so Python docstrings can still be generated.") + else() + message(FATAL_ERROR "Doxygen failed to generate the API documentation (exit code ${DOXYGEN_RESULT}), which is required for the Python docstrings. Doxygen errors: ${DOXYGEN_ERROR}") + endif() + endif() add_custom_target(api COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT} OUTPUT_QUIET) endif() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index bab5e84ba..cd3c68f44 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -64,7 +64,11 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/doxygen/doxygen2docstring.py ${CMAKE_CURRENT_BINARY_DIR}/../doc/api/xml/ - ${CMAKE_CURRENT_BINARY_DIR}/docstring) + ${CMAKE_CURRENT_BINARY_DIR}/docstring + RESULT_VARIABLE DOCSTRING_RESULT) + if(NOT DOCSTRING_RESULT EQUAL 0) + message(FATAL_ERROR "doxygen2docstring.py failed (exit code ${DOCSTRING_RESULT}) while generating the Python docstring headers.") + endif() endif()