1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

FindPython2: avoid doubling the extension in CPython2 SOABI

Commit 951640f1f9 (FindPython: manage SOABI for all Python versions,
2020-08-11) extended support for Python2's SOABI variable in order to
support the PyPy interpreter as well. This caused a regression in the
way that the SOABI variable was built up for the CPython interpreter.
This caused the variable to be set to `.so` which ended up causing a
doubling of the resulting `SOABI` variable in the end.

Co-Author: Marc Chevrier <marc.chevrier@gmail.com>
Fixes: #21548
This commit is contained in:
Ben Boeckel
2020-12-04 13:58:34 -05:00
parent 1a059d91af
commit afb0ffcac7

View File

@@ -452,7 +452,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
list (REMOVE_DUPLICATES _values)
elseif (NAME STREQUAL "SOABI")
# clean-up: remove prefix character and suffix
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
set(_values "")
else()
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
endif()
@@ -504,7 +508,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endforeach()
if (_values)
# clean-up: remove prefix character and suffix
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
set(_values "")
else()
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
endif()
endif()
endif()
else()