[Mlir-commits] [mlir] [MLIR][Python] Avoid printing an unset nanobind include directory (PR #211240)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 22 04:51:32 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Anutosh Bhat (anutosh491)

<details>
<summary>Changes</summary>

`nanobind_INCLUDE_DIR` is only populated when MLIR discovers nanobind through the Python package. When `nanobind_DIR` is supplied explicitly, the variable remains unset and the configuration output contains an empty path:
```
  Found nanobind v2.13.0:
```
The nanobind CMake package location is already reported by both discovery paths. 

We can only print the detected nanobind version in the final status message. Or maybe if we want we can find the include dir for the explicit path too and merge them to `nanobind_INCLUDE_DIR` but I think this is better.

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


1 Files Affected:

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


``````````diff
diff --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 068d6712393c2..4d99c8be0de7f 100644
--- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
+++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
@@ -83,7 +83,7 @@ macro(mlir_configure_python_dev_packages)
       set(nanobind_INCLUDE_DIR "${PACKAGE_DIR}")
     endif()
     find_package(nanobind 2.9 CONFIG REQUIRED)
-    message(STATUS "Found nanobind v${nanobind_VERSION}: ${nanobind_INCLUDE_DIR}")
+    message(STATUS "Found nanobind v${nanobind_VERSION}")
     message(STATUS "Python prefix = '${PYTHON_MODULE_PREFIX}', "
             "suffix = '${PYTHON_MODULE_SUFFIX}', "
             "extension = '${PYTHON_MODULE_EXTENSION}")

``````````

</details>


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


More information about the Mlir-commits mailing list