From 94b3c3bd0e768dc0ed1333910611c36cfb909d14 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 16 Dec 2024 14:44:43 +0100 Subject: [PATCH] [Backport] Use correct exports file for MLIR tools llvm_add_tool() currently does not respect the passed project and puts all tools into LLVMExports.cmake. This means that we end up with binaries like mlir-opt in LLVMExports.cmake instead of MLIRTargets.cmake, where they should be. Adjust llvm_add_tool() to take the project into account. --- llvm/cmake/modules/AddLLVM.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 230620c37027..6d74e58aea6a 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1351,7 +1351,7 @@ macro(llvm_add_tool project name) if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) if( LLVM_BUILD_TOOLS ) - get_target_export_arg(${name} LLVM export_to_llvmexports) + get_target_export_arg(${name} ${project} export_to_llvmexports) install(TARGETS ${name} ${export_to_llvmexports} RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR} @@ -1365,7 +1365,8 @@ macro(llvm_add_tool project name) endif() endif() if( LLVM_BUILD_TOOLS ) - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) + string(TOUPPER "${project}" project_upper) + set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name}) endif() set_target_properties(${name} PROPERTIES FOLDER "Tools") endif() -- Gitee