Skip to content

Commit d6b3b8a

Browse files
[MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen
unittest/Tablegen generates an executable that depends on MLIRIR and LLVMMLIRTableGen. Avoid specifying linkage dependence on LLVM libraries here because then everyone has to depend on those libraries. Differential Revision: https://reviews.llvm.org/D80093
1 parent 8697d44 commit d6b3b8a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

mlir/lib/TableGen/CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
# This library is unusual, since mlir-tblgen depends on it.
2-
# For non-obvious reasons, linking mlir-tblgen fails with
3-
# LLVM_BUILD_LLVM_DYLIB and LLVM_LINK_LLVM_DYLIB unless
4-
# DISABLE_LLVM_LINK_LLVM_DYLIB is set.
1+
# This library is unusual, since mlir-tblgen depends on it, which is
2+
# built with DISABLE_LLVM_LINK_LLVM_DYLIB, this must also be built
3+
# with that option. Otherwise builds with LLVM_BUILD_LLVM_DYLIB and
4+
# LLVM_LINK_LLVM_DYLIB fail. (Note that even if this has no llvm
5+
# component dependencies, LLVM_LINK_LLVM_DYLIB tends to introduce a
6+
# dependence on libLLVM.so) However, it must also be linkable against
7+
# libMLIR.so in some contexts (see unittests/Tablegen, for instance, which
8+
# has a dependance on MLIRIR, which must depend on libLLVM.so). This works
9+
# in this special case because this library is static.
10+
511
llvm_add_library(LLVMMLIRTableGen STATIC
612
Argument.cpp
713
Attribute.cpp
@@ -24,10 +30,6 @@ llvm_add_library(LLVMMLIRTableGen STATIC
2430

2531
ADDITIONAL_HEADER_DIRS
2632
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
27-
28-
LINK_COMPONENTS
29-
TableGen
30-
Demangle
31-
)
33+
)
3234

3335
mlir_check_all_link_libraries(LLVMMLIRTableGen)

0 commit comments

Comments
 (0)