diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-12-04 18:58:34 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2020-12-04 19:01:27 (GMT) |
commit | afb0ffcac7852e1c2d7472ee914081e5eaf0cfe0 (patch) | |
tree | 288bf9a5df6cba7bd44c92857ba4a079deaa7dfc /Modules/FindPython | |
parent | 1a059d91af07993a02a85f4d6043a8e28742aab0 (diff) | |
download | CMake-afb0ffcac7852e1c2d7472ee914081e5eaf0cfe0.zip CMake-afb0ffcac7852e1c2d7472ee914081e5eaf0cfe0.tar.gz CMake-afb0ffcac7852e1c2d7472ee914081e5eaf0cfe0.tar.bz2 |
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
Diffstat (limited to 'Modules/FindPython')
-rw-r--r-- | Modules/FindPython/Support.cmake | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index c8225c4..3732463 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -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() |