From 431d25821b813549148bc9e9c321b17de7d7f0f8 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 20 Apr 2018 11:24:58 +0300 Subject: [PATCH] 0023548: [CEA] Generation of documentation is broken if sphinxcontrib.napolen extension is not available --- cmake/FindSphinx.cmake | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 09d70a1..6688883 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -2,8 +2,16 @@ # # Output variables: # SPHINX_EXECUTABLE - path to the Sphinx executable -# SPHINX_PYTHONPATH - path to the Sphinx Python modules -# +# SPHINX_PYTHONPATH - path to the Sphinx Python modules +# +# Additional features: +# Sphinx_EXTENSIONS - optional variable which can be used to specify +# a list of required Sphinx extensions; not found +# extensions will be reported during the detection +# procedure; by default this variable is empty. +# Example: +# set(Sphinx_EXTENSIONS sphinxcontrib.napoleon) +# ########################################################################### # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE # @@ -61,3 +69,12 @@ IF(SPHINX_EXECUTABLE) SET(SPHINX_THEME "classic") ENDIF() ENDIF(SPHINX_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() -- 2.39.2