1 # This file allows users to call find_package(MLIR) and pick up our targets.
5 set(LLVM_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
6 find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
7 HINTS "@MLIR_CONFIG_LLVM_CMAKE_DIR@")
9 set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
10 set(MLIR_CMAKE_DIR "@MLIR_CONFIG_CMAKE_DIR@")
11 set(MLIR_INCLUDE_DIRS "@MLIR_CONFIG_INCLUDE_DIRS@")
12 set(MLIR_TABLEGEN_EXE "@MLIR_CONFIG_TABLEGEN_EXE@")
13 set(MLIR_PDLL_TABLEGEN_EXE "@MLIR_CONFIG_PDLL_TABLEGEN_EXE@")
14 set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@")
15 set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@")
16 set(MLIR_ENABLE_EXECUTION_ENGINE "@MLIR_ENABLE_EXECUTION_ENGINE@")
19 set(MLIR_INCLUDE_DIR "@MLIR_INCLUDE_DIR@")
20 set(MLIR_MAIN_SRC_DIR "@MLIR_MAIN_SRC_DIR@")
22 set_property(GLOBAL PROPERTY MLIR_ALL_LIBS "@MLIR_ALL_LIBS@")
23 set_property(GLOBAL PROPERTY MLIR_DIALECT_LIBS "@MLIR_DIALECT_LIBS@")
24 set_property(GLOBAL PROPERTY MLIR_CONVERSION_LIBS "@MLIR_CONVERSION_LIBS@")
25 set_property(GLOBAL PROPERTY MLIR_EXTENSION_LIBS "@MLIR_EXTENSION_LIBS@")
26 set_property(GLOBAL PROPERTY MLIR_TRANSLATION_LIBS "@MLIR_TRANSLATION_LIBS@")
27 set_property(GLOBAL PROPERTY MLIR_UPSTREAM_CAPI_LIBS "@MLIR_CAPI_LIBS@")
29 # Provide all our library targets to users.
30 # More specifically, configure MLIR so that it can be directly included in a top
31 # level CMakeLists.txt, but also so that it can be imported via `find_package`.
32 # This is based on how LLVM handles exports.
33 if(NOT TARGET MLIRSupport)
34 @MLIR_CONFIG_INCLUDE_EXPORTS@
37 # By creating these targets here, subprojects that depend on MLIR's
38 # tablegen-generated headers can always depend on these targets whether building
39 # in-tree with MLIR or not.
40 if(NOT TARGET mlir-tablegen-targets)
41 add_custom_target(mlir-tablegen-targets)
43 if(NOT TARGET mlir-headers)
44 add_custom_target(mlir-headers)
46 if(NOT TARGET mlir-generic-headers)
47 add_custom_target(mlir-generic-headers)
49 if(NOT TARGET mlir-doc)
50 add_custom_target(mlir-doc)