Skip to content

Commit adf89c2

Browse files
committed
need more recent pybind11 for free-threaded mode
1 parent 2aa4264 commit adf89c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
3535

3636
find_package(Python COMPONENTS Interpreter Development)
3737

38+
# Check for abiflags, so we can check for free-threaded later.
39+
execute_process(COMMAND ${Python_EXECUTABLE} -c "import sys; print(sys.abiflags, end='')"
40+
OUTPUT_VARIABLE PYTHON_ABIFLAGS)
41+
3842
if(PYBIND11_PREFIX)
3943
add_subdirectory(${PYBIND11_PREFIX} contrib/pybind11)
44+
elseif(PYTHON_ABIFLAGS STREQUAL "t")
45+
message(STATUS "Free-threading Python found. Enabling support (needs pybind11 2.13+).")
46+
find_package(pybind11 2.13 REQUIRED)
4047
else()
4148
find_package(pybind11 2.9 REQUIRED)
4249
endif()

0 commit comments

Comments
 (0)