diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index e925632aa9f..63e04619dc3 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -195,6 +195,7 @@ macro(add_llvm_library name) else() if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO") install(TARGETS ${name} + EXPORT LLVMExports LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endif() @@ -246,6 +247,7 @@ ${name} ignored.") else() if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(TARGETS ${name} + EXPORT LLVMExports LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endif() @@ -294,7 +296,9 @@ macro(add_llvm_tool name) list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL) if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) if( LLVM_BUILD_TOOLS ) - install(TARGETS ${name} RUNTIME DESTINATION bin) + install(TARGETS ${name} + EXPORT LLVMExports + RUNTIME DESTINATION bin) endif() endif() set_target_properties(${name} PROPERTIES FOLDER "Tools") diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 4992be0e2f6..0620ae87c14 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -67,6 +67,8 @@ configure_file( ${llvm_cmake_builddir}/LLVMConfigVersion.cmake @ONLY) +install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}) + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake index b1e15492471..35f1422cc53 100644 --- a/cmake/modules/TableGen.cmake +++ b/cmake/modules/TableGen.cmake @@ -127,6 +127,8 @@ macro(add_tablegen target project) endif() if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - install(TARGETS ${target} RUNTIME DESTINATION bin) + install(TARGETS ${target} + EXPORT LLVMExports + RUNTIME DESTINATION bin) endif() endmacro()