Index: bolt/lib/Target/AArch64/CMakeLists.txt =================================================================== --- bolt/lib/Target/AArch64/CMakeLists.txt +++ bolt/lib/Target/AArch64/CMakeLists.txt @@ -1,5 +1,4 @@ set(LLVM_LINK_COMPONENTS - BOLTCore MC Support AArch64Desc @@ -12,6 +11,8 @@ AArch64CommonTableGen ) +target_link_libraries(LLVMBOLTTargetAArch64 PRIVATE LLVMBOLTCore) + include_directories( ${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64 ${LLVM_BINARY_DIR}/lib/Target/AArch64 Index: bolt/lib/Target/X86/CMakeLists.txt =================================================================== --- bolt/lib/Target/X86/CMakeLists.txt +++ bolt/lib/Target/X86/CMakeLists.txt @@ -1,6 +1,4 @@ set(LLVM_LINK_COMPONENTS - BOLTCore - BOLTUtils MC MCDisassembler Support @@ -15,6 +13,8 @@ X86CommonTableGen ) +target_link_libraries(LLVMBOLTTargetX86 PRIVATE LLVMBOLTCore LLVMBOLTUtils) + include_directories( ${LLVM_MAIN_SRC_DIR}/lib/Target/X86 ${LLVM_BINARY_DIR}/lib/Target/X86 Index: bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt =================================================================== --- bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt +++ bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt @@ -1,8 +1,11 @@ set(LLVM_LINK_COMPONENTS - BOLTRewrite ${LLVM_TARGETS_TO_BUILD} ) add_llvm_fuzzer(llvm-bolt-fuzzer llvm-bolt-fuzzer.cpp ) + +if (TARGET llvm-bolt-fuzzer) + target_link_libraries(llvm-bolt-fuzzer PRIVATE BOLTRewrite) +endif()