[clang] [llvm] [mlir] [CMake] Add dependent project mode for Flang's MLIR (PR #221724)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 07:06:12 PDT 2026


erichkeane wrote:

> > That said, ergonomically, I think detecting 'we added this because a different project needs it' anything automatically is going to be problematic?
> 
> I don't quite follow, can you expand?

Sure!  My opinion is adding MLIR, automatically or not to `LLVM_ENABLE_PROJECTS` should build the whole thing, but with some sort of 'opt in' to only building the minimum.  The thought is that downstreams who want to use a minimal MLIR shouldn't have to modify the LLVM cmake files for their project.

So:
`LLVM_ENABLE_PROJECTS=mlir` would just always build all of MLIR.
`LLVM_ENABLE_PROJECTS=mlir -DMLIR_STANDALONE=On` (or whatever name) would do this.

AND in our LLVM Cmake files, in addition to adding `mlir` to the `LLVM_ENABLE_PROJECTS` list, we ALSO set the `standalone` flag (or whatever name is appropriate).

The idea/hope is that projects downstream could ALSO take advantage of this build time opt.

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


More information about the cfe-commits mailing list