# MLIR project.
+include(GNUInstallDirs)
+
# Check if MLIR is built as a standalone project.
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(mlir)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/mlir include/mlir-c
- DESTINATION include
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT mlir-headers
FILES_MATCHING
PATTERN "*.def"
)
install(DIRECTORY ${MLIR_INCLUDE_DIR}/mlir ${MLIR_INCLUDE_DIR}/mlir-c
- DESTINATION include
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT mlir-headers
FILES_MATCHING
PATTERN "*.def"
+include(GNUInstallDirs)
include(LLVMDistributionSupport)
function(mlir_tablegen ofn)
${export_to_mlirtargets}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
# Note that CMake will create a directory like:
# objects-${CMAKE_BUILD_TYPE}/obj.LibName
# and put object files there.
+include(ExtendPath)
include(LLVMDistributionSupport)
include(FindPrefixFromConfig)
set(MLIR_CONFIG_CMAKE_DIR "\${MLIR_INSTALL_PREFIX}/${MLIR_INSTALL_PACKAGE_DIR}")
set(MLIR_CONFIG_LLVM_CMAKE_DIR "\${MLIR_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
get_config_exports_includes(MLIR MLIR_CONFIG_INCLUDE_EXPORTS)
+extend_path(base_includedir "\${MLIR_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
set(MLIR_CONFIG_INCLUDE_DIRS
- "\${MLIR_INSTALL_PREFIX}/include"
+ "${base_includedir}"
)
# Ensure that we are using the installed mlir-tblgen. This might not be MLIR_TABLEGEN_EXE
# if we're building with a host-optimized mlir-tblgen (with LLVM_OPTIMIZED_TABLEGEN).