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_SRC_SHARDER_TABLEGEN_EXE "@MLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE@")
15 set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@")
16 set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@")
17 set(MLIR_ENABLE_EXECUTION_ENGINE "@MLIR_ENABLE_EXECUTION_ENGINE@")
20 set(MLIR_INCLUDE_DIR "@MLIR_INCLUDE_DIR@")
21 set(MLIR_MAIN_SRC_DIR "@MLIR_MAIN_SRC_DIR@")
23 set_property(GLOBAL PROPERTY MLIR_ALL_LIBS "@MLIR_ALL_LIBS@")
24 set_property(GLOBAL PROPERTY MLIR_DIALECT_LIBS "@MLIR_DIALECT_LIBS@")
25 set_property(GLOBAL PROPERTY MLIR_CONVERSION_LIBS "@MLIR_CONVERSION_LIBS@")
26 set_property(GLOBAL PROPERTY MLIR_EXTENSION_LIBS "@MLIR_EXTENSION_LIBS@")
27 set_property(GLOBAL PROPERTY MLIR_TRANSLATION_LIBS "@MLIR_TRANSLATION_LIBS@")
28 set_property(GLOBAL PROPERTY MLIR_UPSTREAM_CAPI_LIBS "@MLIR_CAPI_LIBS@")
30 # Provide all our library targets to users.
31 # More specifically, configure MLIR so that it can be directly included in a top
32 # level CMakeLists.txt, but also so that it can be imported via `find_package`.
33 # This is based on how LLVM handles exports.
34 if(NOT TARGET MLIRSupport)
35 @MLIR_CONFIG_INCLUDE_EXPORTS@
38 # By creating these targets here, subprojects that depend on MLIR's
39 # tablegen-generated headers can always depend on these targets whether building
40 # in-tree with MLIR or not.
41 if(NOT TARGET mlir-tablegen-targets)
42 add_custom_target(mlir-tablegen-targets)
44 if(NOT TARGET mlir-headers)
45 add_custom_target(mlir-headers)
47 if(NOT TARGET mlir-generic-headers)
48 add_custom_target(mlir-generic-headers)
50 if(NOT TARGET mlir-doc)
51 add_custom_target(mlir-doc)