Skip to content

Commit 983b460

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 <[email protected]>
1 parent e23b1c8 commit 983b460

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
@@ -1504,7 +1504,6 @@ macro(llvm_add_tool project name)
15041504
if( LLVM_BUILD_TOOLS )
15051505
get_target_export_arg(${name} ${project} export_to_llvmexports)
15061506
install(TARGETS ${name}
1507-
${export_to_llvmexports}
15081507
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
15091508
COMPONENT ${name})
15101509
if (LLVM_ENABLE_PDB)
@@ -1520,10 +1519,8 @@ macro(llvm_add_tool project name)
15201519
endif()
15211520
endif()
15221521
endif()
1523-
if( LLVM_BUILD_TOOLS )
1524-
string(TOUPPER "${project}" project_upper)
1525-
set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name})
1526-
endif()
1522+
string(TOUPPER "${project}" project_upper)
1523+
set_target_properties(${name} PROPERTIES FOLDER "Tools")
15271524
endif()
15281525
get_subproject_title(subproject_title)
15291526
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
@@ -1578,7 +1575,6 @@ macro(add_llvm_utility name)
15781575
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
15791576
get_target_export_arg(${name} LLVM export_to_llvmexports)
15801577
install(TARGETS ${name}
1581-
${export_to_llvmexports}
15821578
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
15831579
COMPONENT ${name})
15841580
if (LLVM_ENABLE_PDB)
@@ -1592,7 +1588,6 @@ macro(add_llvm_utility name)
15921588
DEPENDS ${name}
15931589
COMPONENT ${name})
15941590
endif()
1595-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
15961591
elseif(LLVM_BUILD_UTILS)
15971592
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
15981593
endif()

llvm/cmake/modules/TableGen.cmake

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

238238
if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
239239
(LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
240-
set(export_arg)
241-
if(ADD_TABLEGEN_EXPORT)
242-
get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
243-
endif()
244240
install(TARGETS ${target}
245-
${export_arg}
246241
COMPONENT ${target}
247242
RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
248243
if(NOT LLVM_ENABLE_IDE)
@@ -253,7 +248,6 @@ macro(add_tablegen target project)
253248
endif()
254249
if(ADD_TABLEGEN_EXPORT)
255250
string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
256-
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
257251
endif()
258252
endmacro()
259253

0 commit comments

Comments
 (0)