[Mlir-commits] [mlir] [MLIR][CMake] Fix LLVM_DEFINITIONS handling in standalone example (PR #234653)
Christopher Bate
llvmlistbot at llvm.org
Fri Oct 23 06:49:03 PDT 2026
christopherbate wrote:
> I've never seen `LLVM_DEFINITIONS` used this way (manual `add_definitions`). Not that I don't believe it's out there. Would it be possible to just unify on only HandleLLVMOptions setting and adding the compile flags?
That's a bigger change. As noted above, I just want to fix the existing usage here in MLIR. [Using LLVM_DEFINITIONS -> add_definitions is the current official recommendation in the LLVM docs](https://github.com/llvm/llvm-project/blob/main/llvm/docs/CMake.md#embedding-llvm-in-your-project). It probably is possible to unify on HandleLLVMOptions. I can create an RFC to address the more general problem. However, I would probably include communicating definitions and compile flags which can affect the C++ ABI through the targets themselves instead of through ad-hoc variables in the LLVMConfig.cmake.
Here are some examples in community projects that use LLVM which are following the recommended guidance and would need to migrate:
- [Stablehlo](https://github.com/openxla/stablehlo/blob/main/CMakeLists.txt#L181)
- [bpftrace](https://github.com/bpftrace/bpftrace/pull/5353)
There are also several usages of this pattern inside LLVM-Project (besides MLIR's standalone example).
https://github.com/llvm/llvm-project/pull/234653
More information about the Mlir-commits
mailing list