From f16083f3436f1286941547b3036787f128c9d8a4 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 31 Jan 2020 10:56:11 +0200 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: Inappropriate [oe-specific] Signed-off-by: Ovidiu Panait --- clang/cmake/modules/AddClang.cmake | 2 -- llvm/cmake/modules/AddLLVM.cmake | 6 ------ llvm/cmake/modules/TableGen.cmake | 6 ------ 3 files changed, 14 deletions(-) diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 75b0080f6715..ddf446a13eca 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -168,7 +168,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 "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}) @@ -177,7 +176,6 @@ macro(add_clang_tool name) DEPENDS ${name} COMPONENT ${name}) endif() - set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) endif() endif() endmacro() diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 94fc83db9344..5155b0222d87 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1335,7 +1335,6 @@ macro(llvm_add_tool project name) if( LLVM_BUILD_TOOLS ) get_target_export_arg(${name} LLVM export_to_llvmexports) install(TARGETS ${name} - ${export_to_llvmexports} RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR} COMPONENT ${name}) @@ -1346,9 +1345,6 @@ macro(llvm_add_tool project name) endif() endif() endif() - if( LLVM_BUILD_TOOLS ) - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) - endif() set_target_properties(${name} PROPERTIES FOLDER "Tools") endif() endmacro(llvm_add_tool project name) @@ -1393,7 +1389,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}) @@ -1402,7 +1397,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 70c2edb8c833..e012fea08982 100644 --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -189,12 +189,7 @@ macro(add_tablegen target project) if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)) - set(export_arg) - if(ADD_TABLEGEN_EXPORT) - get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg) - endif() install(TARGETS ${target} - ${export_arg} COMPONENT ${target} RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}") if(NOT LLVM_ENABLE_IDE) @@ -205,6 +200,5 @@ macro(add_tablegen target project) endif() if(ADD_TABLEGEN_EXPORT) string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper) - set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target}) endif() endmacro()