Skip to content

Commit f5c2005

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 a6c0dd9 commit f5c2005

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

@@ -191,7 +190,6 @@ macro(add_clang_tool name)
191190
DEPENDS ${name}
192191
COMPONENT ${name})
193192
endif()
194-
set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
195193
endif()
196194
endif()
197195
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
@@ -1492,7 +1492,6 @@ macro(llvm_add_tool project name)
14921492
if( LLVM_BUILD_TOOLS )
14931493
get_target_export_arg(${name} ${project} export_to_llvmexports)
14941494
install(TARGETS ${name}
1495-
${export_to_llvmexports}
14961495
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
14971496
COMPONENT ${name})
14981497
@@ -1503,10 +1502,8 @@ macro(llvm_add_tool project name)
15031502
endif()
15041503
endif()
15051504
endif()
1506-
if( LLVM_BUILD_TOOLS )
1507-
string(TOUPPER "${project}" project_upper)
1508-
set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name})
1509-
endif()
1505+
string(TOUPPER "${project}" project_upper)
1506+
set_target_properties(${name} PROPERTIES FOLDER "Tools")
15101507
endif()
15111508
get_subproject_title(subproject_title)
15121509
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
@@ -1556,7 +1553,6 @@ macro(add_llvm_utility name)
15561553
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
15571554
get_target_export_arg(${name} LLVM export_to_llvmexports)
15581555
install(TARGETS ${name}
1559-
${export_to_llvmexports}
15601556
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
15611557
COMPONENT ${name})
15621558
@@ -1565,7 +1561,6 @@ macro(add_llvm_utility name)
15651561
DEPENDS ${name}
15661562
COMPONENT ${name})
15671563
endif()
1568-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
15691564
elseif(LLVM_BUILD_UTILS)
15701565
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
15711566
endif()

llvm/cmake/modules/TableGen.cmake

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

233233
if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
234234
(LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
235-
set(export_arg)
236-
if(ADD_TABLEGEN_EXPORT)
237-
get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
238-
endif()
239235
install(TARGETS ${target}
240-
${export_arg}
241236
COMPONENT ${target}
242237
RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
243238
if(NOT LLVM_ENABLE_IDE)
@@ -248,6 +243,5 @@ macro(add_tablegen target project)
248243
endif()
249244
if(ADD_TABLEGEN_EXPORT)
250245
string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
251-
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
252246
endif()
253247
endmacro()

0 commit comments

Comments
 (0)