Skip to content

Commit

Permalink
[Test] Only search for Development.SABIModule when using CPython
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Dec 26, 2024
1 parent 9ce1ed6 commit db5b643
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions test-packages/find-python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,37 @@ block(SCOPE_FOR VARIABLES)
endblock()

block(SCOPE_FOR VARIABLES)
find_package(Python3 REQUIRED COMPONENTS Development.SABIModule)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
endif()
if (Python3_Interpreter_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Interpreter' unexpectedly found")
endif()
if (Python3_Development.Embed_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found")
endif()
if (Python3_Development.Module_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found")
endif()
if (NOT Python3_Development.SABIModule_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' not found")
endif()
message(STATUS "Python3_SOSABI: ${Python3_SOSABI}")
if (NOT WIN32 AND NOT Python3_SOSABI)
message (FATAL_ERROR "Python3, SOSABI missing")
if (Python3_FIND_IMPLEMENTATIONS STREQUAL "CPython")
find_package(Python3 REQUIRED COMPONENTS Development.SABIModule)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Failed to find Python 3")
endif()
if (Python3_Development_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
endif()
if (Python3_Interpreter_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Interpreter' unexpectedly found")
endif()
if (Python3_Development.Embed_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found")
endif()
if (Python3_Development.Module_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found")
endif()
if (NOT Python3_Development.SABIModule_FOUND)
message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' not found")
endif()
message(STATUS "Python3_SOSABI: ${Python3_SOSABI}")
if (NOT WIN32 AND NOT Python3_SOSABI)
message (FATAL_ERROR "Python3, SOSABI missing")
endif()
unset(_Python3_SABI_LIBRARY_RELEASE CACHE)
endif()
unset(_Python3_SABI_LIBRARY_RELEASE CACHE)
endblock()

block(SCOPE_FOR VARIABLES)
# https://gitlab.kitware.com/cmake/cmake/-/issues/26493
if (NOT WIN32 OR ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.31.2")
if (Python3_FIND_IMPLEMENTATIONS STREQUAL "CPython" AND (NOT WIN32 OR ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.31.2"))
find_package(Python3 REQUIRED COMPONENTS Development.Module Development.SABIModule)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Failed to find Python 3")
Expand Down

0 comments on commit db5b643

Please sign in to comment.