Make sure no HTML documentation is generated when conversion causes warnings
Previously, the HTML documentation would be generated even if there were warnings, and a subsequent build would consider the documentation up-to-date. It seems like CMake has no option to remove a (possibly partially generated!) target if the command exits with a non-zero status...master
parent
64b04d18dc
commit
c71aca51de
|
@ -32,8 +32,17 @@ if(RST2HTML_EXECUTABLE)
|
|||
set(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it})
|
||||
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.html)
|
||||
|
||||
add_custom_command(OUTPUT ${outfile} COMMAND ${RST2HTML_EXECUTABLE}
|
||||
ARGS ${infile} ${outfile} DEPENDS ${infile})
|
||||
# Unfortunately, cmake does not remove any generated target of a
|
||||
# failed build. So a build with with warnings that are considered
|
||||
# fatal (--exit-status=2) will not be retried.
|
||||
# Execute the command twice to get a full list of warnings and errors,
|
||||
# but to avoid generating the target if there were warnings or errors.
|
||||
add_custom_command( OUTPUT ${outfile}
|
||||
COMMAND ${RST2HTML_EXECUTABLE}
|
||||
ARGS ${RST2HTML_FLAGS} --halt=4 ${infile} /dev/null
|
||||
COMMAND ${RST2HTML_EXECUTABLE}
|
||||
ARGS ${RST2HTML_FLAGS} --quiet ${infile} ${outfile}
|
||||
DEPENDS ${infile})
|
||||
endforeach()
|
||||
endmacro()
|
||||
endif()
|
||||
|
|
|
@ -6,6 +6,8 @@ if(NOT DEFINED USE_RST2HTML)
|
|||
set(USE_RST2HTML -1)
|
||||
endif(NOT DEFINED USE_RST2HTML)
|
||||
|
||||
SET(RST2HTML_FLAGS --exit-status=2)
|
||||
|
||||
SET(REQUIRE_HTML_DOCUMENTATION_DOC "Convert rst documents to html or fail")
|
||||
SET(DISABLE_HTML_DOCUMENTATION_DOC "Don't convert rst documents to html")
|
||||
OPTION(REQUIRE_HTML_DOCUMENTATION ${REQUIRE_HTML_DOCUMENTATION_DOC} False)
|
||||
|
|
Loading…
Reference in New Issue