Skip to content

Commit

Permalink
Add SPHINX_WARNINGS_AS_ERRORS CMake option to allow warnings to not be
Browse files Browse the repository at this point in the history
treated as errors (which is still the default). This is useful when
working on documentation that has existing errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215634 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
delcypher committed Aug 14, 2014
1 parent cb43f81 commit 550abf8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmake/modules/AddSphinxTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ function (add_sphinx_target builder project)
set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${builder}")
set(SPHINX_DOC_TREE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
set(SPHINX_TARGET_NAME docs-${project}-${builder})

if (SPHINX_WARNINGS_AS_ERRORS)
set(SPHINX_WARNINGS_AS_ERRORS_FLAG "-W")
else()
set(SPHINX_WARNINGS_AS_ERRORS_FLAG "")
endif()

add_custom_target(${SPHINX_TARGET_NAME}
COMMAND ${SPHINX_EXECUTABLE}
-b ${builder}
-d "${SPHINX_DOC_TREE_DIR}"
-q # Quiet: no output other than errors and warnings.
-W # Warnings are errors.
${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings as errors if requested
"${CMAKE_CURRENT_SOURCE_DIR}" # Source
"${SPHINX_BUILD_DIR}" # Output
COMMENT
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/FindSphinx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ find_package_handle_standard_args(Sphinx
# Provide options for controlling different types of output
option(SPHINX_OUTPUT_HTML "Output standalone HTML files" ON)
option(SPHINX_OUTPUT_MAN "Output man pages" ON)

option(SPHINX_WARNINGS_AS_ERRORS "When building documentation treat warnings as errors" ON)
4 changes: 4 additions & 0 deletions docs/CMake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ LLVM-specific variables
is enabled). Currently the only target added is ``docs-llvm-man``. Defaults
to ON.

**SPHINX_WARNINGS_AS_ERRORS**:BOOL
If enabled then sphinx documentation warnings will be treated as
errors. Defaults to ON.

Executing the test suite
========================

Expand Down

0 comments on commit 550abf8

Please sign in to comment.