FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE SPHINX_APIDOC_EXECUTABLE)
IF(SPHINX_EXECUTABLE)
+ IF(WIN32)
+ # Call Sphinx through the Python executable to eliminate the problem related to starting the Sphinx's process.
+ GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${SPHINX_EXECUTABLE}" PATH)
+ GET_FILENAME_COMPONENT(_tmp_FILENAME "${SPHINX_EXECUTABLE}" NAME_WE)
+ SET(SPHINX_EXECUTABLE "${PYTHON_EXECUTABLE}" "${_tmp_ROOT_DIR}/${_tmp_FILENAME}-script.py")
+ ENDIF()
+
EXECUTE_PROCESS(COMMAND ${SPHINX_EXECUTABLE} "--version" OUTPUT_VARIABLE SPHINX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE ".* ([0-9.]+)$" "\\1" SPHINX_VERSION "${SPHINX_VERSION}" )
MESSAGE(STATUS "Sphinx version is ${SPHINX_VERSION}")