Skip to content
Snippets Groups Projects
Commit 586151ee authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

Revert "extended _find_python_binary to make sure the binary matches the library version"

This reverts commit 77521f73.
parent 153a3441
Branches
Tags
No related merge requests found
......@@ -70,44 +70,22 @@ endmacro()
macro(_find_python_bin PYTHON_ROOT VERSION)
string(REPLACE "." "" _VERSION_NO_DOTS ${VERSION})
foreach(_NAME "python" "python${_VERSION_NO_DOTS}" "python${VERSION}")
if(PYTHON_ROOT)
find_program(PYTHON_BINARY
NAMES ${_NAME}
HINTS "${PYTHON_ROOT}"
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH)
if(PYTHON_BINARY)
execute_process(COMMAND ${PYTHON_BINARY} -V
OUTPUT_VARIABLE PY_VERSION
ERROR_VARIABLE PY_VERSION)
if(PY_VERSION MATCHES ${VERSION})
break()
else()
unset(PYTHON_BINARY CACHE)
endif()
endif()
else()
find_program(PYTHON_BINARY
NAMES $_NAME
HINTS "${CMAKE_PREFIX_PATH}"
PATH_SUFFIXES bin)
if(PYTHON_BINARY)
execute_process(COMMAND ${PYTHON_BINARY} -V
OUTPUT_VARIABLE PY_VERSION
ERROR_VARIABLE PY_VERSION)
if(${PY_VERSION} matches ${VERSION})
break()
else()
unset(PYTHON_BINARY CACHE)
endif()
endif()
endif()
endforeach()
if(PYTHON_ROOT)
find_program(PYTHON_BINARY
NAMES "python" "python${_VERSION_NO_DOTS}" "python${VERSION}"
HINTS "${PYTHON_ROOT}"
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
else()
find_program(PYTHON_BINARY
NAMES "python" "python${_VERSION_NO_DOTS}" "python${VERSION}"
HINTS "${CMAKE_PREFIX_PATH}"
PATH_SUFFIXES bin
)
endif()
endmacro()
#-------------------------------------------------------------------------------
# check for python lib
#
......@@ -136,7 +114,7 @@ macro(check_for_python_binary)
foreach(_VERSION ${PYTHON_VERSIONS})
if(${PYTHON_MIN_VERSION} VERSION_LESS ${_VERSION})
_find_python_bin("${PYTHON_ROOT}" "${_VERSION}")
if(PYTHON_BINARY)
if(PYTHON_LIBRARIES)
set(PYTHON_VERSION "${_VERSION}")
break()
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment