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
commit0603eb00f9f3b59054730643d167877051dafabf (patch)
tree8ed992e49716d377a4add5ba2d75cb077bafd766 /Tests
parentce2cc7cfb579d99f4392f6b97c93cec3fa08eee3 (diff)
parent951640f1f92e5da6f1c31135cc3aff527987ee67 (diff)
downloadcmake-0603eb00f9f3b59054730643d167877051dafabf.tar.gz
Merge topic 'FindPython-manage-SOABI-in-all-versions'
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()