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