llvm/SOURCES/0001-CMake-Use-correct-exports-for-MLIR-tools.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

2025-03-10 14:23:18 +00:00
From b443e55162861125a50048ae9bc521e98058b273 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Mon, 16 Dec 2024 14:44:43 +0100
Subject: [PATCH] [CMake] 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 006dfb6de3a199..6cf0ee1a54dbdb 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1483,7 +1483,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}
@@ -1497,7 +1497,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()
endif()
get_subproject_title(subproject_title)