Merge pull request #589 from taka-no-me:2digit_pyversion

This commit is contained in:
Andrey Kamaev 2013-02-28 18:06:43 +04:00 committed by OpenCV Buildbot
commit 1018d110d6

View File

@ -19,18 +19,25 @@ unset(HAVE_SPHINX CACHE)
if(PYTHON_EXECUTABLE)
if(PYTHON_VERSION_STRING)
set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
set(PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
ERROR_VARIABLE PYTHON_VERSION_FULL
ERROR_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+.[0-9]+" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_FULL}")
endif()
if("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+.[0-9]+")
set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
elseif("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+")
set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
else()
unset(PYTHON_VERSION_FULL)
endif()
if(NOT ANDROID AND NOT IOS)
if(CMAKE_VERSION VERSION_GREATER 2.8.8)
if(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
else()
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})