Skip to content

Commit 35d4f20

Browse files
authored
[CMake] Use correct exports file for MLIR tools (#120079)
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.
1 parent 76f2589 commit 35d4f20

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ macro(llvm_add_tool project name)
14831483

14841484
if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
14851485
if( LLVM_BUILD_TOOLS )
1486-
get_target_export_arg(${name} LLVM export_to_llvmexports)
1486+
get_target_export_arg(${name} ${project} export_to_llvmexports)
14871487
install(TARGETS ${name}
14881488
${export_to_llvmexports}
14891489
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
@@ -1497,7 +1497,8 @@ macro(llvm_add_tool project name)
14971497
endif()
14981498
endif()
14991499
if( LLVM_BUILD_TOOLS )
1500-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
1500+
string(TOUPPER "${project}" project_upper)
1501+
set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name})
15011502
endif()
15021503
endif()
15031504
get_subproject_title(subproject_title)

0 commit comments

Comments
 (0)