Skip to content

Commit

Permalink
Check existence of Python::SABIModule for CPython SWIG example
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Dec 1, 2024
1 parent 1e91447 commit 694dd1d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/swig-project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ set_target_properties(add_module PROPERTIES
target_compile_definitions(add_module PRIVATE VERSION_INFO="${PY_FULL_VERSION}")

# Link to the correct Python library and configure the appropriate ABI
if (TARGET Python::SABIModule AND Python_INTERPRETER_ID STREQUAL "Python")
if (Python_INTERPRETER_ID STREQUAL "Python")
if (NOT TARGET Python::SABIModule)
message(SEND_ERROR "CPython requires component Development.SABIModule")
endif()
message(STATUS "Using CPython stable ABI (${Py_LIMITED_API} - ${Python_SOSABI})")
set_target_properties(add_module PROPERTIES
SWIG_COMPILE_DEFINITIONS Py_LIMITED_API=${Py_LIMITED_API})
Expand Down

0 comments on commit 694dd1d

Please sign in to comment.