[Mlir-commits] [mlir] [MLIR][IRDL][CMake] CMake fixes for cross-compilation (PR #145672)

Maksim Levental llvmlistbot at llvm.org
Tue Jul 1 15:50:31 PDT 2025


makslevental wrote:

I'm not 100% sure on what's going on here but generally these tools are referred to by `*_EXE` instead of the target for cross-compile (specifically the `NATIVE` stuff you're seeing) because they're precursors that need to run on the host. So eg `mlir-linalg-ods-yaml-gen` is built for host instead of target because it generates source at build time of `mlir-opt` and etc:

https://github.com/llvm/llvm-project/blob/e9c9f8f3748a1666dfd099da7990ebe4523778bf/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt#L7-L17

Looking at [mlir-irdl-to-cpp/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/e9c9f8f3748a1666dfd099da7990ebe4523778bf/mlir/tools/mlir-irdl-to-cpp/CMakeLists.txt) I see someone tried to maybe do the same thing?? but didn't quite nail it? E.g., I'm not sure why you'd build for the native target when `LLVM_USE_HOST_TOOLS=ON`. Then again I'm not sure what the intent for this tool is. But certainly if you want `add_irdl_to_cpp_target` to be run in the service of e.g. building `mlir-opt` then you need a host tool and so you wouldn't want to `DEPEND` on the target.

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


More information about the Mlir-commits mailing list