Skip to content

Commit e6a2229

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 0212a75 commit e6a2229

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
@@ -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
@@ -240,12 +240,7 @@ macro(add_tablegen target project)
240240

241241
if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
242242
(LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
243-
set(export_arg)
244-
if(ADD_TABLEGEN_EXPORT)
245-
get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
246-
endif()
247243
install(TARGETS ${target}
248-
${export_arg}
249244
COMPONENT ${target}
250245
RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
251246
if(NOT LLVM_ENABLE_IDE)
@@ -256,6 +251,5 @@ macro(add_tablegen target project)
256251
endif()
257252
if(ADD_TABLEGEN_EXPORT)
258253
string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
259-
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
260254
endif()
261255
endmacro()

0 commit comments

Comments
 (0)