summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-19 15:36:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-08-19 15:36:51 (GMT)
commite9d0059bb3db439c7b1f26ddfcaf140ac70fbeb6 (patch)
treed02d3a9ec3a4019d3570eb6bf32109968419c365 /Modules
parent09e8de75d5997ad2a57049426c5dc3b9238e2d34 (diff)
parent72822e26c9f5c3a83fde718af110dcf28b54994d (diff)
downloadCMake-e9d0059bb3db439c7b1f26ddfcaf140ac70fbeb6.zip
CMake-e9d0059bb3db439c7b1f26ddfcaf140ac70fbeb6.tar.gz
CMake-e9d0059bb3db439c7b1f26ddfcaf140ac70fbeb6.tar.bz2
Merge topic 'FindPython-enhance-version-extraction-from-lib-name' into release-3.18
72822e26c9 FindPython: enhance robustness of version extraction from library name Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5135
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPython/Support.cmake7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index a927a5d..1d68c44 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -558,18 +558,19 @@ function (_PYTHON_GET_VERSION)
if (_PGV_LIBRARY)
# retrieve version and abi from library name
if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
+ get_filename_component (library_name "${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}" NAME)
# extract version from library name
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "python([23])([0-9]+)")
+ if (library_name MATCHES "python([23])([0-9]+)")
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 (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "python([23])\\.([0-9]+)([dmu]*)")
+ elseif (library_name MATCHES "python([23])\\.([0-9]+)([dmu]*)")
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 "${CMAKE_MATCH_3}" PARENT_SCOPE)
- elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "pypy(3)?")
+ elseif (library_name MATCHES "pypy(3)?-c")
set (version "${CMAKE_MATCH_1}")
if (version EQUAL "3")
set (${_PGV_PREFIX}VERSION_MAJOR "3" PARENT_SCOPE)