Fix MLIR build with MLIR_INCLUDE_TESTS=OFF

error message

/usr/bin/ld: CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o: in function `main':
mlir-opt.cpp:(.text.startup.main+0xb9): undefined reference to `mlir::registerTestDialect(mlir::DialectRegistry&)'

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D86592
This commit is contained in:
Ni Hui 2020-08-27 04:01:23 +00:00 committed by Mehdi Amini
parent 62b39b3a0c
commit df2efd7700
1 changed files with 2 additions and 0 deletions

View File

@ -133,7 +133,9 @@ int main(int argc, char **argv) {
#endif
DialectRegistry registry;
registerAllDialects(registry);
#ifdef MLIR_INCLUDE_TESTS
registerTestDialect(registry);
#endif
return failed(MlirOptMain(argc, argv, "MLIR modular optimizer driver\n",
registry,
/*preloadDialectsInContext=*/false));