blob: 939164e63621614ce44898c16d058ba87276202c [file] [log] [blame]
NAKAMURA Takumib5c4b8762013-12-10 11:13:32 +00001set(LLVM_LINK_COMPONENTS
Daniel Sanders3e4acaa2019-05-23 23:02:56 +00002 AllTargetsAsmParsers
3 AllTargetsCodeGens
Daniel Sanders4cecdaa2019-05-24 02:15:27 +00004 AllTargetsDescs
Daniel Sanders3e4acaa2019-05-23 23:02:56 +00005 AllTargetsDisassemblers
Daniel Sanders4cecdaa2019-05-24 02:15:27 +00006 AllTargetsInfos
NAKAMURA Takumib5c4b8762013-12-10 11:13:32 +00007 BitReader
8 Core
9 MCDisassembler
10 Object
Amaury Sechetf01be742016-02-05 00:19:50 +000011 Support
NAKAMURA Takumib5c4b8762013-12-10 11:13:32 +000012 Target
13 )
Anders Waldenborgb932c662013-10-23 08:10:20 +000014
Chris Bieneman9ef9c112014-12-18 21:03:49 +000015# We should only have llvm-c-test use libLLVM if libLLVM is built with the
16# default list of components. Using libLLVM with custom components can result in
17# build failures.
18
19set (USE_LLVM_DYLIB FALSE)
20
21if (TARGET LLVM)
22 set (USE_LLVM_DYLIB TRUE)
23 if (DEFINED LLVM_DYLIB_COMPONENTS)
24 foreach(c in ${LLVM_LINK_COMPONENTS})
25 list(FIND LLVM_DYLIB_COMPONENTS ${c} C_IDX)
26 if (C_IDX EQUAL -1)
27 set(USE_LLVM_DYLIB FALSE)
28 break()
29 endif()
30 endforeach()
31 endif()
32endif()
33
34if(USE_LLVM_DYLIB)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000035 set(LLVM_LINK_COMPONENTS)
36endif()
37
Anders Waldenborgb932c662013-10-23 08:10:20 +000038if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
Rafael Espindola4daaa8e2014-01-08 11:48:19 +000039 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wstrict-prototypes")
Anders Waldenborgb932c662013-10-23 08:10:20 +000040endif ()
41
42add_llvm_tool(llvm-c-test
Amaury Sechet003216b2016-11-15 22:19:59 +000043 attributes.c
Anders Waldenborgb932c662013-10-23 08:10:20 +000044 calc.c
whitequark789164d2017-11-01 22:18:52 +000045 debuginfo.c
Jeroen Ketemaad659c32016-04-08 09:19:02 +000046 diagnostic.c
Anders Waldenborgb932c662013-10-23 08:10:20 +000047 disassemble.c
Amaury Sechete8ea7d82016-02-04 23:26:19 +000048 echo.cpp
Anders Waldenborgb932c662013-10-23 08:10:20 +000049 helpers.c
50 include-all.c
51 main.c
52 module.c
Bjorn Steinbrinka09ac002015-01-28 16:35:59 +000053 metadata.c
Anders Waldenborgb932c662013-10-23 08:10:20 +000054 object.c
55 targets.c
56 )
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000057
Chris Bieneman9ef9c112014-12-18 21:03:49 +000058if(USE_LLVM_DYLIB)
NAKAMURA Takumif96d4232014-11-10 15:04:26 +000059 target_link_libraries(llvm-c-test LLVM)
60endif()