summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-12 15:13:08 +0000
committerKitware Robot <kwrobot@kitware.com>2020-08-12 11:13:16 -0400
commit0ca6d5766b2a2e37408065d9e77dd364e26f121a (patch)
treed98f310a1d43e8992c37aff0ad561834206e4c9f /Tests
parentedd908fc3994e28b760f206b07c75f7f7c4fac69 (diff)
parent951640f1f92e5da6f1c31135cc3aff527987ee67 (diff)
downloadcmake-0ca6d5766b2a2e37408065d9e77dd364e26f121a.tar.gz
Merge topic 'FindPython-manage-SOABI-in-all-versions' into release-3.18
951640f1f9 FindPython: manage SOABI for all Python versions Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5119
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 4a6aea3537..36daa9f81e 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -20,3 +20,19 @@ if (Python3_Development_FOUND AND Python3_SOABI)
message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
endif()
endif()
+
+
+find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+if(NOT DEFINED Python2_SOABI)
+ message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+endif()
+
+if (Python2_Development_FOUND AND Python2_SOABI)
+ Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c)
+ target_compile_definitions (spam2 PRIVATE PYTHON2)
+
+ get_property (suffix TARGET spam2 PROPERTY SUFFIX)
+ if (NOT suffix MATCHES "^.${Python2_SOABI}")
+ message(FATAL_ERROR "Module suffix do not include Python2_SOABI")
+ endif()
+endif()