FindPython: Add variable Python_SOABI

This variable holds the standard extension suffix for modules.

Fixes: #20150
This commit is contained in:
Marc Chevrier
2020-01-07 16:42:15 +01:00
parent 635225513e
commit 61502d3956
6 changed files with 104 additions and 6 deletions

View File

@@ -148,6 +148,34 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
add_test(NAME FindPython.Interpreter.SOABI COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
"${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Interpreter"
${build_generator_args}
--build-project TestSOABI
--build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
"-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
"-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
"-DCMake_TEST_FindPython_COMPONENT=Interpreter"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.Development.SOABI COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/SOABI"
"${CMake_BINARY_DIR}/Tests/FindPython/SOABI.Development"
${build_generator_args}
--build-project TestSOABI
--build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
"-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
"-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
"-DCMake_TEST_FindPython_COMPONENT=Development"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
endif()
if(CMake_TEST_FindPython_NumPy)

View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.1)
project(TestSOABI C)
find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
if (NOT Python3_FOUND)
message (FATAL_ERROR "Fail to found Python 3")
endif()
if(NOT DEFINED Python3_SOABI)
message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
endif()