summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-21 12:55:51 +0000
committerKitware Robot <kwrobot@kitware.com>2023-03-21 08:56:06 -0400
commitbf6131fc9a164ddf7d2ed02b6870cdbce4efd4e8 (patch)
tree6ac7f0926bcaa38e6d31690df6442f14bad03344
parent5e5a21aadd1468e81ff7795c352898f2e115ae0e (diff)
parent4c902d675b764ad3d8f54a6e235547d289752c45 (diff)
downloadcmake-bf6131fc9a164ddf7d2ed02b6870cdbce4efd4e8.tar.gz
Merge topic 'FindPython-SOSABI-handling' into release-3.26
4c902d675b FindPython: ensure Stable ABI is correctly handled Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8345
-rw-r--r--Modules/FindPython.cmake2
-rw-r--r--Modules/FindPython/Support.cmake2
-rw-r--r--Tests/FindPython/Python3SABIModule/CMakeLists.txt8
3 files changed, 8 insertions, 4 deletions
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index fd2eeaa33b..31ef1c7d53 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -542,7 +542,7 @@ If the library type is not specified, ``MODULE`` is assumed.
was introduced. Specifying only major version ``3`` is equivalent to ``3.2``.
When option ``WITH_SOABI`` is also specified, the module suffix will include
- the ``Python3_SOSABI`` value, if any.
+ the ``Python_SOSABI`` value, if any.
#]=======================================================================]
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index f1be0f4dae..517ac21eb7 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -579,7 +579,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endif()
endif()
elseif (NAME STREQUAL "SOSABI")
- execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib.machinery\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _values
ERROR_QUIET
diff --git a/Tests/FindPython/Python3SABIModule/CMakeLists.txt b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
index 2a067d0604..e045b69e67 100644
--- a/Tests/FindPython/Python3SABIModule/CMakeLists.txt
+++ b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.7)
project(TestPython3SABIModule LANGUAGES C)
@@ -35,12 +35,16 @@ if(NOT TARGET Python3::SABIModule)
message(SEND_ERROR "Python3::SABIModule not found")
endif()
+if (Python3_VERSION VERSION_GREATER_EQUAL "3.2" AND NOT Python3_SOSABI)
+ message(FATAL_ERROR "Python3_SOSABI unexpectedly not defined")
+endif()
+
Python3_add_library (spam3 MODULE USE_SABI 3 WITH_SOABI ../spam.c)
target_compile_definitions (spam3 PRIVATE PYTHON3)
if (Python3_SOSABI)
get_property (suffix TARGET spam3 PROPERTY SUFFIX)
- if (NOT suffix MATCHES "^.${Python3_SOSABI}")
+ if (NOT suffix MATCHES "^\\.${Python3_SOSABI}")
message(FATAL_ERROR "Module suffix do not include Python3_SOSABI")
endif()
endif()