From ceb900589ec52587f5861c86fb0c9fc574cc9406 Mon Sep 17 00:00:00 2001 From: David Hallas Date: Tue, 17 Dec 2019 18:07:50 +0100 Subject: [PATCH] build: Fix build on Gentoo Linux (#854) Fixes the build on Gentoo Linux. On Gentoo Linux the user chooses which llvm backend to build and install, therefore we need to loop over the installed targets and append the libraries needed instead of relying on the full list of supported backends. --- CMakeLists.txt | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaf04cf0..5be059f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,24 +305,18 @@ if (BUILD_CXX_LANGUAGE_PACKAGE) link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) llvm_map_components_to_libnames(REQ_LLVM_LIBS - support core libdriver passes - x86asmparser x86codegen - aarch64asmparser aarch64codegen - amdgpuasmparser amdgpucodegen - armasmparser armcodegen - bpfasmparser bpfcodegen - hexagonasmparser hexagoncodegen - lanaiasmparser lanaicodegen - mipsasmparser mipscodegen - msp430asmparser msp430codegen - nvptxcodegen - powerpcasmparser powerpccodegen - riscvasmparser riscvcodegen - sparcasmparser sparccodegen - systemzasmparser systemzcodegen - webassemblyasmparser webassemblycodegen - xcorecodegen + support core libdriver passes option ) + foreach(LLVM_TARGET ${LLVM_TARGETS_TO_BUILD}) + get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}CodeGen") + list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}CodeGen") + list(APPEND REQ_LLVM_LIBS "${lib_deps}") + get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}AsmParser") + if (NOT "${lib_deps}" STREQUAL "") + list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}AsmParser") + list(APPEND REQ_LLVM_LIBS "${lib_deps}") + endif() + endforeach() set(CLANG_LIBRARIES clangASTMatchers