[Mlir-commits] [mlir] [MLIR][Build] Adding find_package for pybind (PR #153579)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Aug 14 07:02:48 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Zhuoran Yin (jerryyin)

<details>
<summary>Changes</summary>

In different build environments, LLVM build occasionally fail on not being able to find the pybind package. Adding this help LLVM find it and fix the build failure for me.

---
Full diff: https://github.com/llvm/llvm-project/pull/153579.diff


1 Files Affected:

- (modified) mlir/cmake/modules/AddMLIRPython.cmake (+1) 


``````````diff
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index c14e614ed7d92..4354af8792f33 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -661,6 +661,7 @@ function(add_mlir_python_extension libname extname)
   # sources that must be compiled in accordance with pybind11 needs (RTTI and
   # exceptions).
   if(NOT DEFINED ARG_PYTHON_BINDINGS_LIBRARY OR ARG_PYTHON_BINDINGS_LIBRARY STREQUAL "pybind11")
+    find_package(pybind11 REQUIRED)
     pybind11_add_module(${libname}
       ${ARG_SOURCES}
     )

``````````

</details>


https://github.com/llvm/llvm-project/pull/153579


More information about the Mlir-commits mailing list