blob: 405dc3df4eee67aeb789e366d1d3a6c824f66365 [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
7 Target
8 )
Anders Waldenborgb932c662013-10-23 08:10:20 +00009
Chris Bieneman9ef9c112014-12-18 21:03:49 +000010# 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
14set (USE_LLVM_DYLIB FALSE)
15
16if (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()
27endif()
28
29if(USE_LLVM_DYLIB)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000030 set(LLVM_LINK_COMPONENTS)
31endif()
32
Anders Waldenborgb932c662013-10-23 08:10:20 +000033if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
Rafael Espindola4daaa8e2014-01-08 11:48:19 +000034 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wstrict-prototypes")
Anders Waldenborgb932c662013-10-23 08:10:20 +000035endif ()
36
37add_llvm_tool(llvm-c-test
38 calc.c
39 disassemble.c
Amaury Sechete8ea7d82016-02-04 23:26:19 +000040 echo.cpp
Anders Waldenborgb932c662013-10-23 08:10:20 +000041 helpers.c
42 include-all.c
43 main.c
44 module.c
Bjorn Steinbrinka09ac002015-01-28 16:35:59 +000045 metadata.c
Anders Waldenborgb932c662013-10-23 08:10:20 +000046 object.c
47 targets.c
48 )
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000049
Chris Bieneman9ef9c112014-12-18 21:03:49 +000050if(USE_LLVM_DYLIB)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000051 target_link_libraries(llvm-c-test LLVM)
52endif()