[llvm] r215634 - Add SPHINX_WARNINGS_AS_ERRORS CMake option to allow warnings to not be

Dan Liew dan at su-root.co.uk
Thu Aug 14 04:57:13 PDT 2014


Author: delcypher
Date: Thu Aug 14 06:57:13 2014
New Revision: 215634

URL: http://llvm.org/viewvc/llvm-project?rev=215634&view=rev
Log:
Add SPHINX_WARNINGS_AS_ERRORS CMake option to allow warnings to not be
treated as errors (which is still the default). This is useful when
working on documentation that has existing errors.

Modified:
    llvm/trunk/cmake/modules/AddSphinxTarget.cmake
    llvm/trunk/cmake/modules/FindSphinx.cmake
    llvm/trunk/docs/CMake.rst

Modified: llvm/trunk/cmake/modules/AddSphinxTarget.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddSphinxTarget.cmake?rev=215634&r1=215633&r2=215634&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddSphinxTarget.cmake (original)
+++ llvm/trunk/cmake/modules/AddSphinxTarget.cmake Thu Aug 14 06:57:13 2014
@@ -8,12 +8,19 @@ function (add_sphinx_target builder proj
   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

Modified: llvm/trunk/cmake/modules/FindSphinx.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/FindSphinx.cmake?rev=215634&r1=215633&r2=215634&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/FindSphinx.cmake (original)
+++ llvm/trunk/cmake/modules/FindSphinx.cmake Thu Aug 14 06:57:13 2014
@@ -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)

Modified: llvm/trunk/docs/CMake.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.rst?rev=215634&r1=215633&r2=215634&view=diff
==============================================================================
--- llvm/trunk/docs/CMake.rst (original)
+++ llvm/trunk/docs/CMake.rst Thu Aug 14 06:57:13 2014
@@ -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
 ========================
 





More information about the llvm-commits mailing list