@@ -388,6 +388,9 @@ function(add_mlir_library name)
388388
389389 if (TARGET ${name} )
390390 target_link_libraries (${name} INTERFACE ${LLVM_COMMON_LIBS} )
391+ if (ARG_INSTALL_WITH_TOOLCHAIN)
392+ set_target_properties (${name} PROPERTIES MLIR_INSTALL_WITH_TOOLCHAIN TRUE )
393+ endif ()
391394 if (NOT ARG_DISABLE_INSTALL)
392395 add_mlir_library_install(${name} )
393396 endif ()
@@ -617,28 +620,29 @@ endfunction(add_mlir_aggregate)
617620# This is usually done as part of add_mlir_library but is broken out for cases
618621# where non-standard library builds can be installed.
619622function (add_mlir_library_install name )
620- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
621- get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries)
622- install (TARGETS ${name}
623- COMPONENT ${name}
624- ${export_to_mlirtargets}
625- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
626- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
627- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
628- # Note that CMake will create a directory like:
629- # objects-${CMAKE_BUILD_TYPE}/obj.LibName
630- # and put object files there.
631- OBJECTS DESTINATION lib${LLVM_LIBDIR_SUFFIX}
632- )
623+ get_target_property (_install_with_toolchain ${name} MLIR_INSTALL_WITH_TOOLCHAIN)
624+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR _install_with_toolchain)
625+ get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries)
626+ install (TARGETS ${name}
627+ COMPONENT ${name}
628+ ${export_to_mlirtargets}
629+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
630+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
631+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
632+ # Note that CMake will create a directory like:
633+ # objects-${CMAKE_BUILD_TYPE}/obj.LibName
634+ # and put object files there.
635+ OBJECTS DESTINATION lib${LLVM_LIBDIR_SUFFIX}
636+ )
633637
634- if (NOT LLVM_ENABLE_IDE)
635- add_llvm_install_targets(install -${name}
636- DEPENDS ${name}
637- COMPONENT ${name} )
638- endif ()
639- set_property (GLOBAL APPEND PROPERTY MLIR_ALL_LIBS ${name} )
638+ if (NOT LLVM_ENABLE_IDE)
639+ add_llvm_install_targets(install -${name}
640+ DEPENDS ${name}
641+ COMPONENT ${name} )
642+ endif ()
643+ set_property (GLOBAL APPEND PROPERTY MLIR_ALL_LIBS ${name} )
644+ set_property (GLOBAL APPEND PROPERTY MLIR_EXPORTS ${name} )
640645 endif ()
641- set_property (GLOBAL APPEND PROPERTY MLIR_EXPORTS ${name} )
642646endfunction ()
643647
644648# Declare an mlir library which is part of the public C-API.
0 commit comments