Skip to content

Commit 26e6755

Browse files
opanait-wrkraj
authored andcommitted
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 <ovidiu.panait@windriver.com>
1 parent fec28de commit 26e6755

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ macro(add_clang_tool name)
182182
if (CLANG_BUILD_TOOLS)
183183
get_target_export_arg(${name} Clang export_to_clangtargets)
184184
install(TARGETS ${name}
185-
${export_to_clangtargets}
186185
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
187186
COMPONENT ${name})
188187

@@ -195,7 +194,6 @@ macro(add_clang_tool name)
195194
DEPENDS ${name}
196195
COMPONENT ${name})
197196
endif()
198-
set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
199197
endif()
200198
endif()
201199
set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,6 @@ macro(llvm_add_tool project name)
14951495
if( LLVM_BUILD_TOOLS )
14961496
get_target_export_arg(${name} ${project} export_to_llvmexports)
14971497
install(TARGETS ${name}
1498-
${export_to_llvmexports}
14991498
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
15001499
COMPONENT ${name})
15011500
if (LLVM_ENABLE_PDB)
@@ -1511,10 +1510,8 @@ macro(llvm_add_tool project name)
15111510
endif()
15121511
endif()
15131512
endif()
1514-
if( LLVM_BUILD_TOOLS )
1515-
string(TOUPPER "${project}" project_upper)
1516-
set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name})
1517-
endif()
1513+
string(TOUPPER "${project}" project_upper)
1514+
set_target_properties(${name} PROPERTIES FOLDER "Tools")
15181515
endif()
15191516
get_subproject_title(subproject_title)
15201517
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
@@ -1569,7 +1566,6 @@ macro(add_llvm_utility name)
15691566
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
15701567
get_target_export_arg(${name} LLVM export_to_llvmexports)
15711568
install(TARGETS ${name}
1572-
${export_to_llvmexports}
15731569
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
15741570
COMPONENT ${name})
15751571
if (LLVM_ENABLE_PDB)
@@ -1583,7 +1579,6 @@ macro(add_llvm_utility name)
15831579
DEPENDS ${name}
15841580
COMPONENT ${name})
15851581
endif()
1586-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
15871582
elseif(LLVM_BUILD_UTILS)
15881583
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
15891584
endif()

llvm/cmake/modules/TableGen.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,7 @@ macro(add_tablegen target project)
231231

232232
if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
233233
(LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
234-
set(export_arg)
235-
if(ADD_TABLEGEN_EXPORT)
236-
get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
237-
endif()
238234
install(TARGETS ${target}
239-
${export_arg}
240235
COMPONENT ${target}
241236
RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
242237
if(NOT LLVM_ENABLE_IDE)
@@ -247,6 +242,5 @@ macro(add_tablegen target project)
247242
endif()
248243
if(ADD_TABLEGEN_EXPORT)
249244
string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
250-
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
251245
endif()
252246
endmacro()

0 commit comments

Comments
 (0)