|
| 1 | +From b443e55162861125a50048ae9bc521e98058b273 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Nikita Popov < [email protected]> |
| 3 | +Date: Mon, 16 Dec 2024 14:44:43 +0100 |
| 4 | +Subject: [PATCH] [CMake] Use correct exports file for MLIR tools |
| 5 | + |
| 6 | +llvm_add_tool() currently does not respect the passed project and |
| 7 | +puts all tools into LLVMExports.cmake. This means that we end up |
| 8 | +with binaries like mlir-opt in LLVMExports.cmake instead of |
| 9 | +MLIRTargets.cmake, where they should be. |
| 10 | + |
| 11 | +Adjust llvm_add_tool() to take the project into account. |
| 12 | +--- |
| 13 | + llvm/cmake/modules/AddLLVM.cmake | 5 +++-- |
| 14 | + 1 file changed, 3 insertions(+), 2 deletions(-) |
| 15 | + |
| 16 | +diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake |
| 17 | +index 006dfb6de3a199..6cf0ee1a54dbdb 100644 |
| 18 | +--- a/llvm/cmake/modules/AddLLVM.cmake |
| 19 | ++++ b/llvm/cmake/modules/AddLLVM.cmake |
| 20 | +@@ -1483,7 +1483,7 @@ macro(llvm_add_tool project name) |
| 21 | + |
| 22 | + if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 23 | + if( LLVM_BUILD_TOOLS ) |
| 24 | +- get_target_export_arg(${name} LLVM export_to_llvmexports) |
| 25 | ++ get_target_export_arg(${name} ${project} export_to_llvmexports) |
| 26 | + install(TARGETS ${name} |
| 27 | + ${export_to_llvmexports} |
| 28 | + RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR} |
| 29 | +@@ -1497,7 +1497,8 @@ macro(llvm_add_tool project name) |
| 30 | + endif() |
| 31 | + endif() |
| 32 | + if( LLVM_BUILD_TOOLS ) |
| 33 | +- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) |
| 34 | ++ string(TOUPPER "${project}" project_upper) |
| 35 | ++ set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name}) |
| 36 | + endif() |
| 37 | + endif() |
| 38 | + get_subproject_title(subproject_title) |
0 commit comments