Skip to content

Commit d990dad

Browse files
authored
[CMAKE] Look for Development.Module instead of Development (#129729)
Based on the [cmake issue](https://gitlab.kitware.com/cmake/cmake/-/issues/23716) and [manylinux issue](pypa/manylinux#1347), when building a python module, it should find the `Development.Module` module, not `Development`, which includes `Development.Module` and `Development.Embed`, and will expect the shared python library only. After this PR and before #124613, pytorch could be built with a static libpython (e.g. in manylinux). Cherry-pick of 953c647 into release/2.4
1 parent e4ee3be commit d990dad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmake/Dependencies.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ if(NOT Python_EXECUTABLE)
850850
endif()
851851

852852
if(BUILD_PYTHON)
853-
set(PYTHON_COMPONENTS Development)
853+
set(PYTHON_COMPONENTS Development.Module)
854854
if(USE_NUMPY)
855855
list(APPEND PYTHON_COMPONENTS NumPy)
856856
endif()
@@ -870,7 +870,7 @@ endif()
870870

871871
# ---[ Python + Numpy
872872
if(BUILD_PYTHON)
873-
if(Python_Development_FOUND)
873+
if(Python_Development.Module_FOUND)
874874
if(USE_NUMPY)
875875
if(NOT Python_NumPy_FOUND)
876876
message(WARNING "NumPy could not be found. Not building with NumPy. Suppress this warning with -DUSE_NUMPY=OFF")

0 commit comments

Comments
 (0)