diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-08-11 10:16:40 +0200 |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-08-11 10:16:40 +0200 |
commit | 951640f1f92e5da6f1c31135cc3aff527987ee67 (patch) | |
tree | 70542aaee69bdede5dd2383800c6675d95874b8d /Tests/FindPython | |
parent | b8214a87bf3962029a3d35863ec0187f7c1819d7 (diff) | |
download | cmake-951640f1f92e5da6f1c31135cc3aff527987ee67.tar.gz |
FindPython: manage SOABI for all Python versions
Fixes: #21070
Diffstat (limited to 'Tests/FindPython')
-rw-r--r-- | Tests/FindPython/SOABI/CMakeLists.txt | 16 |
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() |