CMakeLists.txt 997 B

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