blob: 991e853f0b04c223ac6d17578cdf04b48df28099 [file] [log] [blame]
NAKAMURA Takumib5c4b8762013-12-10 11:13:32 +00001set(LLVM_LINK_COMPONENTS
2 ${LLVM_TARGETS_TO_BUILD}
3 BitReader
4 Core
5 MCDisassembler
6 Object
Amaury Sechetf01be742016-02-05 00:19:50 +00007 Support
NAKAMURA Takumib5c4b8762013-12-10 11:13:32 +00008 Target
9 )
Anders Waldenborgb932c662013-10-23 08:10:20 +000010
Chris Bieneman9ef9c112014-12-18 21:03:49 +000011# 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)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000031 set(LLVM_LINK_COMPONENTS)
32endif()
33
Anders Waldenborgb932c662013-10-23 08:10:20 +000034if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
Rafael Espindola4daaa8e2014-01-08 11:48:19 +000035 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wstrict-prototypes")
Anders Waldenborgb932c662013-10-23 08:10:20 +000036endif ()
37
38add_llvm_tool(llvm-c-test
39 calc.c
40 disassemble.c
Amaury Sechete8ea7d82016-02-04 23:26:19 +000041 echo.cpp
Anders Waldenborgb932c662013-10-23 08:10:20 +000042 helpers.c
43 include-all.c
44 main.c
45 module.c
Bjorn Steinbrinka09ac002015-01-28 16:35:59 +000046 metadata.c
Anders Waldenborgb932c662013-10-23 08:10:20 +000047 object.c
48 targets.c
49 )
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000050
Chris Bieneman9ef9c112014-12-18 21:03:49 +000051if(USE_LLVM_DYLIB)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000052 target_link_libraries(llvm-c-test LLVM)
53endif()