[mlir] Fix calling the native mlir-tblgen tool when cross compiling flang
authorMartin Storsjö <martin@martin.st>
Fri, 15 Jul 2022 21:11:00 +0000 (00:11 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 2 Aug 2022 07:58:24 +0000 (10:58 +0300)
commit112499f35f4169f798d7f6436cf60e822b9c1da0
treec72238e2ebedf4096a9b01885ffded7482c3e91e
parent46b5ab15cdd568256085d2fd28fb3c8e9cafab53
[mlir] Fix calling the native mlir-tblgen tool when cross compiling flang

When the mlir-tblgen tool is set up, the `MLIR_TABLEGEN_EXE` variable
is set, which either points to the mlir-tblgen tool built in the current
cmake build, or points to one built in a nested cmake build (if cross
conpiling, or if building with e.g. `LLVM_OPTIMIZED_TABLEGEN`.

The `MLIR_TABLEGEN_EXE` variable is only set within the scope of the
mlir/CMakeLists.txt file, so it's unavailable in sibling level projects
such as flang.

Set the `MLIR_TABLEGEN_EXE` and the `MLIR_TABLEGEN_TARGET` variables
as global, so that flang can use them properly without guessing.

Differential Revision: https://reviews.llvm.org/D130350
flang/CMakeLists.txt
mlir/CMakeLists.txt