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