mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
Merge pull request #589 from taka-no-me:2digit_pyversion
This commit is contained in:
commit
1018d110d6
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user