FindPythonLibs: honor EXACT version specification (#13216)
This commit is contained in:
parent
55cadb6806
commit
9d145b0998
|
@ -45,13 +45,19 @@ IF(PythonLibs_FIND_VERSION)
|
||||||
STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
|
STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
|
||||||
STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
UNSET(_PYTHON_FIND_OTHER_VERSIONS)
|
UNSET(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
IF(NOT PythonLibs_FIND_VERSION_EXACT)
|
IF(PythonLibs_FIND_VERSION_EXACT)
|
||||||
|
IF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
||||||
|
SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}")
|
||||||
|
ELSE(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
||||||
|
SET(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
|
ENDIF(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
||||||
|
ELSE(PythonLibs_FIND_VERSION_EXACT)
|
||||||
FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||||
IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||||
LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF(NOT PythonLibs_FIND_VERSION_EXACT)
|
ENDIF(PythonLibs_FIND_VERSION_EXACT)
|
||||||
UNSET(_PYTHON_FIND_MAJ_MIN)
|
UNSET(_PYTHON_FIND_MAJ_MIN)
|
||||||
UNSET(_PYTHON_FIND_MAJ)
|
UNSET(_PYTHON_FIND_MAJ)
|
||||||
ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||||
|
|
Loading…
Reference in New Issue