]> SALOME platform Git repositories - tools/configuration.git/commitdiff
Salome HOME
bos #23972 [CEA 19980] sphinxcontrib_napoleon is not needed with Sphinx >= 1.3
authorvsr <vsr@opencascade.com>
Fri, 19 Feb 2021 06:51:31 +0000 (09:51 +0300)
committervsr <vsr@opencascade.com>
Fri, 19 Feb 2021 06:51:31 +0000 (09:51 +0300)
cmake/FindSphinx.cmake
cmake/UseSphinx.cmake

index 307ee9d34045aa5fee570fc941ce8566a5765554..788397567d9ca246cf1b57478821f490abfa6b92 100644 (file)
@@ -56,11 +56,9 @@ ENDIF()
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE SPHINX_APIDOC_EXECUTABLE SPHINX_INTL_EXECUTABLE)
 
-FOREACH(_ext ${Sphinx_EXTENSIONS})
-  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import ${_ext}; print('ok')" OUTPUT_VARIABLE _has_ext ERROR_QUIET)
-  IF(_has_ext)
-    MESSAGE(STATUS "Required Sphinx extension '${_ext}' has been found!")
-  ELSE()
-    MESSAGE(WARNING "Required Sphinx extension '${_ext}' is not found!")
-  ENDIF()
-ENDFOREACH()
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print(sphinx.__version__)" OUTPUT_VARIABLE SPHINX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+IF(SPHINX_VERSION)
+  MESSAGE(STATUS "Found Sphinx version ${SPHINX_VERSION}")
+ELSE()
+  MESSAGE(STATUS "Found Sphinx (unknown version)")
+ENDIF()
\ No newline at end of file
index 4b5551410849a56c9ae7b4380094a7a0cf3b43ef..0ff9081dbe3572436d40ac34073d89af7ef0bc61 100644 (file)
@@ -24,6 +24,22 @@ IF(NOT Sphinx_FOUND)
    MESSAGE(FATAL_ERROR "Developer error -> UseSphinx file should be included after detection of the sphinx!")
 ENDIF()
 
+FUNCTION(SPHINX_CHECK_EXTENSIONS)
+  CMAKE_PARSE_ARGUMENTS(CHECK_EXTENSIONS "REQUIRED" "" "" ${ARGN})
+  FOREACH(_ext ${CHECK_EXTENSIONS_UNPARSED_ARGUMENTS})
+    EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import ${_ext}; print('ok')" OUTPUT_VARIABLE _has_ext ERROR_QUIET)
+    IF(_has_ext)
+      MESSAGE(STATUS "Required Sphinx extension '${_ext}' has been found!")
+    ELSE()
+      IF(CHECK_EXTENSIONS_REQUIRED)
+        MESSAGE(FATAL_ERROR "Required Sphinx extension '${_ext}' is not found!")
+      ELSE()
+        MESSAGE(WARNING "Required Sphinx extension '${_ext}' is not found!")
+      ENDIF()
+    ENDIF()
+  ENDFOREACH()
+ENDFUNCTION()
+
 function(JOIN OUTPUT GLUE)
     set(_TMP_RESULT "")
     set(_GLUE "") # effective glue is empty at the beginning
@@ -130,4 +146,4 @@ MACRO(ADD_MULTI_LANG_DOCUMENTATION)
   ENDFOREACH()
   SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
 
-ENDMACRO(ADD_MULTI_LANG_DOCUMENTATION)
\ No newline at end of file
+ENDMACRO(ADD_MULTI_LANG_DOCUMENTATION)