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