[PATCH] D76047: [MLIR] Add support for out of tree external projects using MLIR
Jean Perier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 19 11:27:22 PDT 2020
jeanPerier added a comment.
Hi, thanks for improving the way one can plugin MLIR ! While trying to rebase our f18 project <https://github.com/flang-compiler/f18> that uses MLIR after this patch, I had a cmake issue using installed LLVMs out-of-tree, I tracked it to one of the line in this patch (see in-lined comment).
================
Comment at: mlir/cmake/modules/MLIRConfig.cmake.in:22
+# Provide all our library targets to users.
+include("@MLIR_CONFIG_EXPORTS_FILE@")
+
----------------
I am now getting a build error here when building out-of-tree projects that use AddMLIR (in my case f18) and are provided an installed LLVM directory path (as opposed to a build directory path):
```
CMake Error at <my-llvm-install-dir>/lib/cmake/mlir/MLIRConfig.cmake:27 (include):
include could not find load file:
<my-llvm-install-dir>/lib/cmake/mlir/MLIRTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:93 (find_package)
```
Providing an llvm build directory path to f18 cmake command, I do not have that issue (<my-llvm-build-dir>/lib/cmake/mlir/MLIRTargets.cmake always exists for me, but not <my-llvm-install-dir>/lib/cmake/mlir/MLIRTargets.cmake).
The issue seems to be that MLIRTargets.cmake is installed conditionally (depending on `MLIR_HAS_EXPORTS`), but it is expected to exists unconditionally here.
Would it make sens to make this line something like :
```
if (EXISTS "@MLIR_CONFIG_EXPORTS_FILE@")
include("@MLIR_CONFIG_EXPORTS_FILE@")
endif()
```
or to always install MLIRTargets ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76047/new/
https://reviews.llvm.org/D76047
More information about the llvm-commits
mailing list