FindPython: python_add_library can now manage SOABI suffix.

Fixes: #20408
This commit is contained in:
Marc Chevrier
2020-03-03 13:10:16 +01:00
parent d1cb554c99
commit 0c97b73bc0
6 changed files with 52 additions and 14 deletions

View File

@@ -10,3 +10,13 @@ endif()
if(NOT DEFINED Python3_SOABI)
message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
endif()
if (Python3_Development_FOUND AND Python3_SOABI)
Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c)
target_compile_definitions (spam3 PRIVATE PYTHON3)
get_property (suffix TARGET spam3 PROPERTY SUFFIX)
if (NOT suffix MATCHES "^.${Python3_SOABI}")
message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
endif()
endif()