1set(LLVM_LINK_COMPONENTS 2 ${LLVM_TARGETS_TO_BUILD} 3 BitReader 4 Core 5 MCDisassembler 6 Object 7 Support 8 Target 9 ) 10 11# We should only have llvm-c-test use libLLVM if libLLVM is built with the 12# default list of components. Using libLLVM with custom components can result in 13# build failures. 14 15set (USE_LLVM_DYLIB FALSE) 16 17if (TARGET LLVM) 18 set (USE_LLVM_DYLIB TRUE) 19 if (DEFINED LLVM_DYLIB_COMPONENTS) 20 foreach(c in ${LLVM_LINK_COMPONENTS}) 21 list(FIND LLVM_DYLIB_COMPONENTS ${c} C_IDX) 22 if (C_IDX EQUAL -1) 23 set(USE_LLVM_DYLIB FALSE) 24 break() 25 endif() 26 endforeach() 27 endif() 28endif() 29 30if(USE_LLVM_DYLIB) 31 set(LLVM_LINK_COMPONENTS) 32endif() 33 34if (LLVM_COMPILER_IS_GCC_COMPATIBLE) 35 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wstrict-prototypes") 36endif () 37 38add_llvm_tool(llvm-c-test 39 calc.c 40 diagnostic.c 41 disassemble.c 42 echo.cpp 43 helpers.c 44 include-all.c 45 main.c 46 module.c 47 metadata.c 48 object.c 49 targets.c 50 ) 51 52if(USE_LLVM_DYLIB) 53 target_link_libraries(llvm-c-test LLVM) 54endif() 55