Commit bd6f80fa authored by Roman Donchenko's avatar Roman Donchenko

Redo the Sphinx check to do the same thing on all platforms.

This also fixes the bug where the Sphinx version gets detected as
"Sphinx vX.Y.Z" instead of "X.Y.Z" on Unix-like systems.
parent f6848b66
...@@ -104,18 +104,12 @@ if(PYTHON_EXECUTABLE) ...@@ -104,18 +104,12 @@ if(PYTHON_EXECUTABLE)
if(BUILD_DOCS) if(BUILD_DOCS)
find_host_program(SPHINX_BUILD sphinx-build) find_host_program(SPHINX_BUILD sphinx-build)
if(SPHINX_BUILD) if(SPHINX_BUILD)
if(UNIX) execute_process(COMMAND "${SPHINX_BUILD}"
execute_process(COMMAND sh -c "${SPHINX_BUILD} -_ 2>&1 | sed -ne 1p" OUTPUT_QUIET
RESULT_VARIABLE SPHINX_PROCESS ERROR_VARIABLE SPHINX_OUTPUT
OUTPUT_VARIABLE SPHINX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE) if(SPHINX_OUTPUT MATCHES "^Sphinx v([0-9][^ \n]*)")
else() set(SPHINX_VERSION "${CMAKE_MATCH_1}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__"
RESULT_VARIABLE SPHINX_PROCESS
OUTPUT_VARIABLE SPHINX_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(SPHINX_PROCESS EQUAL 0)
set(HAVE_SPHINX 1) set(HAVE_SPHINX 1)
message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}") message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")
endif() endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment