0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. From 728e023a8d2dc85402fbe1295e87023fdb7c4c1b Mon Sep 17 00:00:00 2001
  2. From: Ovidiu Panait <ovidiu.panait@windriver.com>
  3. Date: Fri, 31 Jan 2020 10:56:11 +0200
  4. Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
  5. find_package()
  6. Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
  7. that depends on LLVM/Clang tries to run cmake find_package() during
  8. do_configure, it will fail with a similar error:
  9. | The imported target "llvm-tblgen" references the file
  10. | ".../recipe-sysroot/usr/bin/llvm-tblgen"
  11. |
  12. | but this file does not exist. Possible reasons include:
  13. | * The file was deleted, renamed, or moved to another location.
  14. | * An install or uninstall procedure did not complete successfully.
  15. | * The installation package was faulty and contained
  16. | ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
  17. | but not all the files it references.
  18. This is due to the fact that currently the cmake scripts look for target
  19. binaries in sysroot. Work around this by not exporting the target binaries in
  20. Exports-* cmake files.
  21. Upstream-Status: Innapropriate [oe-specific]
  22. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
  23. ---
  24. clang/cmake/modules/AddClang.cmake | 2 --
  25. llvm/cmake/modules/AddLLVM.cmake | 6 ------
  26. llvm/cmake/modules/TableGen.cmake | 7 -------
  27. 3 files changed, 15 deletions(-)
  28. diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
  29. index 9bbbfc032b7d..7ee5170bbc71 100644
  30. --- a/clang/cmake/modules/AddClang.cmake
  31. +++ b/clang/cmake/modules/AddClang.cmake
  32. @@ -159,7 +159,6 @@ macro(add_clang_tool name)
  33. if (CLANG_BUILD_TOOLS)
  34. get_target_export_arg(${name} Clang export_to_clangtargets)
  35. install(TARGETS ${name}
  36. - ${export_to_clangtargets}
  37. RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
  38. COMPONENT ${name})
  39. @@ -168,7 +167,6 @@ macro(add_clang_tool name)
  40. DEPENDS ${name}
  41. COMPONENT ${name})
  42. endif()
  43. - set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
  44. endif()
  45. endmacro()
  46. diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
  47. index 37bc98f9e021..d34083fa52ec 100644
  48. --- a/llvm/cmake/modules/AddLLVM.cmake
  49. +++ b/llvm/cmake/modules/AddLLVM.cmake
  50. @@ -1251,7 +1251,6 @@ macro(add_llvm_tool name)
  51. if( LLVM_BUILD_TOOLS )
  52. get_target_export_arg(${name} LLVM export_to_llvmexports)
  53. install(TARGETS ${name}
  54. - ${export_to_llvmexports}
  55. RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
  56. COMPONENT ${name})
  57. @@ -1262,9 +1261,6 @@ macro(add_llvm_tool name)
  58. endif()
  59. endif()
  60. endif()
  61. - if( LLVM_BUILD_TOOLS )
  62. - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
  63. - endif()
  64. set_target_properties(${name} PROPERTIES FOLDER "Tools")
  65. endmacro(add_llvm_tool name)
  66. @@ -1304,7 +1300,6 @@ macro(add_llvm_utility name)
  67. if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
  68. get_target_export_arg(${name} LLVM export_to_llvmexports)
  69. install(TARGETS ${name}
  70. - ${export_to_llvmexports}
  71. RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
  72. COMPONENT ${name})
  73. @@ -1313,7 +1308,6 @@ macro(add_llvm_utility name)
  74. DEPENDS ${name}
  75. COMPONENT ${name})
  76. endif()
  77. - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
  78. elseif(LLVM_BUILD_UTILS)
  79. set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
  80. endif()
  81. diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
  82. index 59fd0d3b0733..3b9ac56ed37f 100644
  83. --- a/llvm/cmake/modules/TableGen.cmake
  84. +++ b/llvm/cmake/modules/TableGen.cmake
  85. @@ -183,14 +183,8 @@ macro(add_tablegen target project)
  86. endif()
  87. if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
  88. - set(export_to_llvmexports)
  89. - if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
  90. - NOT LLVM_DISTRIBUTION_COMPONENTS)
  91. - set(export_to_llvmexports EXPORT LLVMExports)
  92. - endif()
  93. install(TARGETS ${target}
  94. - ${export_to_llvmexports}
  95. COMPONENT ${target}
  96. RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
  97. if(NOT LLVM_ENABLE_IDE)
  98. @@ -199,5 +193,4 @@ macro(add_tablegen target project)
  99. COMPONENT ${target})
  100. endif()
  101. endif()
  102. - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
  103. endmacro()