From ca6f2f080f9060d6c2edd383c9912865425c1878 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 8 Oct 2012 22:18:13 +0400 Subject: [PATCH] hopefully, correctly applied modified patch #2034 that handles Windows case --- cmake/OpenCVDetectPython.cmake | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 8be94ca..d0903fd 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -95,19 +95,23 @@ if(PYTHON_EXECUTABLE) endif(NOT ANDROID AND NOT IOS) if(BUILD_DOCS) - # look for Sphinx - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__" - RESULT_VARIABLE SPHINX_PROCESS - OUTPUT_VARIABLE SPHINX_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - - - if(SPHINX_PROCESS EQUAL 0) - find_host_program(SPHINX_BUILD sphinx-build) - if(SPHINX_BUILD) - set(HAVE_SPHINX 1) - message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}") - endif() + find_host_program(SPHINX_BUILD sphinx-build) + if(SPHINX_BUILD) + if(UNIX) + execute_process(COMMAND sh -c "${SPHINX_BUILD} -_ 2>&1 | sed -ne 1p" + RESULT_VARIABLE SPHINX_PROCESS + OUTPUT_VARIABLE SPHINX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + 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) + message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}") + endif() endif() endif(BUILD_DOCS) endif(PYTHON_EXECUTABLE) -- 2.7.4