From: vsr Date: Fri, 19 Feb 2021 06:51:31 +0000 (+0300) Subject: bos #23972 [CEA 19980] sphinxcontrib_napoleon is not needed with Sphinx >= 1.3 X-Git-Tag: V9_7_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=df40c3e5bdd2fc0a4c0430d4b9a77c1d07c00302;p=tools%2Fconfiguration.git bos #23972 [CEA 19980] sphinxcontrib_napoleon is not needed with Sphinx >= 1.3 --- diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 307ee9d..7883975 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -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 diff --git a/cmake/UseSphinx.cmake b/cmake/UseSphinx.cmake index 4b55514..0ff9081 100644 --- a/cmake/UseSphinx.cmake +++ b/cmake/UseSphinx.cmake @@ -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)