From 5440eafaae078153c4b397c4b04e987690f63dc0 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Wed, 20 Apr 2022 15:24:19 +0200 Subject: FindPython: Add support for pypy v7.3.9 and uppers Library name versioning has changed. Fixes: #23439 --- Modules/FindPython/Support.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index afe9743..8391f16 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -415,7 +415,6 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) if (_PGN_WIN32) foreach (version IN LISTS _PGN_VERSION) string (REPLACE "." "" version_no_dots ${version}) - set (name "python${version_no_dots}") if (_PGN_DEBUG) string (APPEND name "_d") @@ -423,6 +422,13 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) list (APPEND names "${name}") endforeach() endif() + + if (_PGN_POSIX) + foreach(version IN LISTS _PGN_VERSION) + list (APPEND names "pypy${version}-c") + endforeach() + endif() + list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_LIB_NAMES}) endif() endif() @@ -588,6 +594,11 @@ function (_PYTHON_GET_VERSION) set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE) + elseif (library_name MATCHES "pypy([23])\\.([0-9]+)-c") + set (${_PGV_PREFIX}VERSION_MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE) + set (${_PGV_PREFIX}ABI "" PARENT_SCOPE) elseif (library_name MATCHES "pypy(3)?-c") set (version "${CMAKE_MATCH_1}") # try to pick-up a more precise version from the path -- cgit v0.12