Commit a01fc717 by Christian Kern

generate cmake error on doxygen warning, when WARNINGS_ARE_ERRORS is enabled

parent cd0ebac0
...@@ -40,13 +40,30 @@ function (CreateDoxygenDocumentationTarget) ...@@ -40,13 +40,30 @@ function (CreateDoxygenDocumentationTarget)
if (TARGET doxygen) if (TARGET doxygen)
# Do nothing, since the repeated adding causes an error # Do nothing, since the repeated adding causes an error
else() else()
add_custom_target (
doxygen FILE(WRITE ${CMAKE_BINARY_DIR}/doxygen_makefile.cmake "
#ALL MESSAGE(STATUS \"Running Doxygen\")
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile EXECUTE_PROCESS(
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) COMMAND \${EXE} \${IN}
# IF you do NOT want the documentation to be generated EVERY time you build the project ERROR_VARIABLE DOXYGEN_OUT_ERR
# then leave out the 'ALL' keyword from the above command. RESULT_VARIABLE DOXYGEN_OUT_RESULT)
STRING(LENGTH \"\${DOXYGEN_OUT_ERR}\" LENGTH_ERR)
IF ( NOT \${LENGTH_ERR} STREQUAL \"0\" )
MESSAGE (WARNING \"Doxygen produced following warnings and or/errors: \${DOXYGEN_OUT_ERR}\")
IF ( \${WARNINGS_ARE_ERRORS} STREQUAL ON OR NOT \${DOXYGEN_OUT_RESULT} STREQUAL \"0\" )
MESSAGE (FATAL_ERROR \"Exiting doxygen generation due to errors (or warnings, if WARNINGS_ARE_ERRORS is enabled)\")
ENDIF ()
ENDIF ()
")
add_custom_target(doxygen)
add_custom_command(
TARGET doxygen
COMMAND ${CMAKE_COMMAND}
-DEXE=${DOXYGEN_EXECUTABLE}
-DIN=${PROJECT_BINARY_DIR}/Doxyfile
-DWARNINGS_ARE_ERRORS=${WARNINGS_ARE_ERRORS}
-P ${CMAKE_BINARY_DIR}/doxygen_makefile.cmake)
endif() endif()
endif() endif()
endfunction() endfunction()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment