diff --git a/cmake_support/FindPython.cmake b/cmake_support/FindPython.cmake index 66c62f51cd8fcf5fc26af7f5e3f60dbed35a1713..1548454dba4e61d5e2ac517c8b4fbff85af499eb 100644 --- a/cmake_support/FindPython.cmake +++ b/cmake_support/FindPython.cmake @@ -42,7 +42,7 @@ endmacro() macro(_find_python PYTHON_ROOT VERSION) - string(REPLACE "." "" _VERSION_NO_DOTS ${VERSION}) + string(REPLACE "." "" _VERSION_NO_DOTS "${VERSION}") if(PYTHON_ROOT) find_library(PYTHON_LIBRARIES NAMES "python${_VERSION_NO_DOTS}" "python${VERSION}" @@ -69,17 +69,17 @@ macro(_find_python PYTHON_ROOT VERSION) endmacro() macro(_find_python_bin PYTHON_ROOT VERSION) - string(REPLACE "." "" _VERSION_NO_DOTS ${VERSION}) + string(REPLACE "." "" _VERSION_NO_DOTS "${VERSION}") if(PYTHON_ROOT) find_program(PYTHON_BINARY - NAMES "python" "python${_VERSION_NO_DOTS}" "python${VERSION}" + NAMES "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}" + NAMES "python${_VERSION_NO_DOTS}" "python${VERSION}" HINTS "${CMAKE_PREFIX_PATH}" PATH_SUFFIXES bin ) @@ -105,6 +105,10 @@ macro(check_for_python_lib) endif() endforeach() endif() + # fallback to non-versioned naming scheme + if (NOT $PYTHON_LIBRARIES) + _find_python("${PYTHON_ROOT}" "") + endif() endmacro() macro(check_for_python_binary) @@ -121,6 +125,9 @@ macro(check_for_python_binary) endif() endforeach() endif() + if (NOT PYTHON_BINARY) + _find_python("${PYTHON_ROOT}" "") + endif() endmacro() if(NOT PYTHON_ROOT)