• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  attributes.c
40  calc.c
41  debuginfo.c
42  diagnostic.c
43  disassemble.c
44  echo.cpp
45  helpers.c
46  include-all.c
47  main.c
48  module.c
49  metadata.c
50  object.c
51  targets.c
52  )
53
54if(USE_LLVM_DYLIB)
55  target_link_libraries(llvm-c-test LLVM)
56endif()
57