123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- From 2e93c0280148283e2d3d525972ad8a2a54861c5f Mon Sep 17 00:00:00 2001
- From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- Date: Fri, 22 Oct 2021 11:43:42 +0800
- Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
- find_package()
- Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
- that depends on LLVM/Clang tries to run cmake find_package() during
- do_configure, it will fail with a similar error:
- | The imported target "llvm-tblgen" references the file
- | ".../recipe-sysroot/usr/bin/llvm-tblgen"
- |
- | but this file does not exist. Possible reasons include:
- | * The file was deleted, renamed, or moved to another location.
- | * An install or uninstall procedure did not complete successfully.
- | * The installation package was faulty and contained
- | ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
- | but not all the files it references.
- This is due to the fact that currently the cmake scripts look for target
- binaries in sysroot. Work around this by not exporting the target binaries in
- Exports-* cmake files.
- Upstream-Status: Innapropriate [oe-specific]
- Rebased to LLVM 14.0.0 by Jun Yuan Tan
- Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
- Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
- ---
- clang/cmake/modules/AddClang.cmake | 2 --
- llvm/cmake/modules/AddLLVM.cmake | 6 ------
- llvm/cmake/modules/TableGen.cmake | 7 -------
- 3 files changed, 15 deletions(-)
- diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
- index 5752f4277444..f40ea35faf46 100644
- --- a/clang/cmake/modules/AddClang.cmake
- +++ b/clang/cmake/modules/AddClang.cmake
- @@ -158,7 +158,6 @@ macro(add_clang_tool name)
- if (CLANG_BUILD_TOOLS)
- get_target_export_arg(${name} Clang export_to_clangtargets)
- install(TARGETS ${name}
- - ${export_to_clangtargets}
- RUNTIME DESTINATION bin
- COMPONENT ${name})
-
- @@ -167,7 +166,6 @@ macro(add_clang_tool name)
- DEPENDS ${name}
- COMPONENT ${name})
- endif()
- - set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
- endif()
- endmacro()
-
- diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
- index 6e1f97a8bbc0..e29bdee0aaa3 100644
- --- a/llvm/cmake/modules/AddLLVM.cmake
- +++ b/llvm/cmake/modules/AddLLVM.cmake
- @@ -1244,7 +1244,6 @@ macro(add_llvm_tool name)
- if( LLVM_BUILD_TOOLS )
- get_target_export_arg(${name} LLVM export_to_llvmexports)
- install(TARGETS ${name}
- - ${export_to_llvmexports}
- RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
- COMPONENT ${name})
-
- @@ -1255,9 +1254,6 @@ macro(add_llvm_tool name)
- endif()
- endif()
- endif()
- - if( LLVM_BUILD_TOOLS )
- - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- - endif()
- set_target_properties(${name} PROPERTIES FOLDER "Tools")
- endmacro(add_llvm_tool name)
-
- @@ -1297,7 +1293,6 @@ macro(add_llvm_utility name)
- if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
- get_target_export_arg(${name} LLVM export_to_llvmexports)
- install(TARGETS ${name}
- - ${export_to_llvmexports}
- RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
- COMPONENT ${name})
-
- @@ -1306,7 +1301,6 @@ macro(add_llvm_utility name)
- DEPENDS ${name}
- COMPONENT ${name})
- endif()
- - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- elseif(LLVM_BUILD_UTILS)
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
- endif()
- diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
- index 5e9e2674405e..3c72df35b308 100644
- --- a/llvm/cmake/modules/TableGen.cmake
- +++ b/llvm/cmake/modules/TableGen.cmake
- @@ -179,14 +179,8 @@ macro(add_tablegen target project)
- endif()
-
- if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
- - set(export_to_llvmexports)
- - if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
- - NOT LLVM_DISTRIBUTION_COMPONENTS)
- - set(export_to_llvmexports EXPORT LLVMExports)
- - endif()
-
- install(TARGETS ${target}
- - ${export_to_llvmexports}
- COMPONENT ${target}
- RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
- if(NOT LLVM_ENABLE_IDE)
- @@ -195,5 +189,4 @@ macro(add_tablegen target project)
- COMPONENT ${target})
- endif()
- endif()
- - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
- endmacro()
- --
- 2.33.0
|