The dependency to library LLVMX86Utils is missing if llvm_map_components_to_libnames is used. See output of: project(bug) cmake_minimum_required(VERSION 2.8) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/opt/llvm-trunk/share/llvm/cmake") include(LLVMConfig) llvm_map_components_to_libnames(tmplibs X86) message("Libraries: ${tmplibs}") Output is: Libraries: LLVMX86CodeGen;LLVMX86AsmPrinter;LLVMX86AsmParser;LLVMX86Desc;LLVMX86Info;LLVMX86Disassembler If llvm_map_components_to_libnames(tmplibs X86) is replaced with llvm_map_components_to_libraries(tmplibs X86), then the output is: Libraries: LLVMX86CodeGen;LLVMX86AsmParser;LLVMX86Disassembler;LLVMAsmPrinter;LLVMSelectionDAG;LLVMX86Desc;LLVMMCParser;LLVMCodeGen;LLVMX86AsmPrinter;LLVMX86Info;LLVMScalarOpts;LLVMX86Utils;LLVMInstCombine;LLVMTransformUtils;LLVMipa;LLVMAnalysis;LLVMTarget;LLVMCore;LLVMMC;LLVMObject;LLVMSupport;dl;pthread 1) Please note the missing LLVMX86Utils 2) Using llvm_map_components_to_libraries this way with LLVM trunk results in an infinte loop
*** Bug 21017 has been marked as a duplicate of this bug. ***
AArch64 is also affected.
@Takumi: I CC you because I think you did most of the work on the cmake scripts.
1) Please note the missing LLVMX86Utils It's expected. The name "X86" is expanded to essential components. Consider the target FOO that doesn't have LLVMFOOUtils. CMake's target_link_libraries() will work transitively. LLVMX86CodeGen will bring in LLVMX86Utils. 2) Using llvm_map_components_to_libraries this way with LLVM trunk results in an infinte loop Although it is deprecated, it's a bug. I reproduced infinite loop. Removing llvm_map_components_to_libraries() would be an option. :)