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
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
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)