summaryrefslogtreecommitdiff
path: root/Modules/FindPython
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-08 15:17:54 +0000
committerKitware Robot <kwrobot@kitware.com>2020-12-08 10:18:29 -0500
commit6412d17b4f13bb2b8a91b52e4f60717f6782db67 (patch)
treed6715d056ef0715a1f0a0898df2d0c9eddff79da /Modules/FindPython
parent1cb30467a319a33dd6cda88832621670437b6852 (diff)
parentafb0ffcac7852e1c2d7472ee914081e5eaf0cfe0 (diff)
downloadcmake-6412d17b4f13bb2b8a91b52e4f60717f6782db67.tar.gz
Merge topic 'FindPython-python2-soabi-suffix-fix'
afb0ffcac7 FindPython2: avoid doubling the extension in CPython2 SOABI Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5574
Diffstat (limited to 'Modules/FindPython')
-rw-r--r--Modules/FindPython/Support.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 0e7646842f..0c775f7fb2 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -456,7 +456,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()
@@ -508,7 +512,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()