================
@@ -43,6 +43,20 @@ set(CLANG_CONFIG_INCLUDE_DIRS
   "${CLANG_SOURCE_DIR}/include"
   "${CLANG_BINARY_DIR}/include"
   )
+set(clang_config_needs_mlir OFF)
+if(CLANG_ENABLE_CIR AND NOT "mlir" IN_LIST LLVM_DEPENDENCY_ONLY_PROJECTS)
+  set(clang_config_needs_mlir ON)
----------------
aokblast wrote:

> > That means the extenal project should never use it as it is not explicitly 
> > specified in the LLVM_ENABLE_PROJECT
> 
> I don't quite follow what you mean: the whole reason why the project is added 
> implicitly is so that clang can use it. And it'll actually need to link to it 
> regardless of if it is implicit or not.

I think I didn't explain this clearly.

`LLVM_DEPENDENCY_ONLY_PROJECTS` does not generate `MLIRTargets.cmake`, so I 
don't think MLIR should be specified there. Instead, `ClangTargets.cmake` adds 
these libraries as static imported targets:

```cmake
add_library(MLIRCIRAnalysis STATIC IMPORTED)

set_target_properties(MLIRCIRAnalysis PROPERTIES
  INTERFACE_LINK_LIBRARIES 
"MLIRCIR;MLIRIR;MLIRAnalysis;MLIRSideEffectInterfaces"
)
```

If `LLVM_ENABLE_PROJECTS` does not include `mlir`, wouldn't this mean that we 
don't need to use `find_package(MLIR)` at all? `ClangTargets.cmake` already 
provides the imported MLIR targets.


https://github.com/llvm/llvm-project/pull/226763
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to