NAKAMURA Takumi | b5c4b876 | 2013-12-10 11:13:32 +0000 | [diff] [blame] | 1 | set(LLVM_LINK_COMPONENTS |
| 2 | ${LLVM_TARGETS_TO_BUILD} |
| 3 | BitReader |
| 4 | Core |
| 5 | MCDisassembler |
| 6 | Object |
| 7 | Target |
| 8 | ) |
Anders Waldenborg | b932c66 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 9 | |
Chris Bieneman | 9ef9c11 | 2014-12-18 21:03:49 +0000 | [diff] [blame] | 10 | # 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 | |
| 14 | set (USE_LLVM_DYLIB FALSE) |
| 15 | |
| 16 | if (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() |
| 27 | endif() |
| 28 | |
| 29 | if(USE_LLVM_DYLIB) |
NAKAMURA Takumi | f96d423 | 2014-11-10 15:04:26 +0000 | [diff] [blame] | 30 | set(LLVM_LINK_COMPONENTS) |
| 31 | endif() |
| 32 | |
Anders Waldenborg | b932c66 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 33 | if (LLVM_COMPILER_IS_GCC_COMPATIBLE) |
Rafael Espindola | 4daaa8e | 2014-01-08 11:48:19 +0000 | [diff] [blame] | 34 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wstrict-prototypes") |
Anders Waldenborg | b932c66 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 35 | endif () |
| 36 | |
| 37 | add_llvm_tool(llvm-c-test |
| 38 | calc.c |
| 39 | disassemble.c |
| 40 | helpers.c |
| 41 | include-all.c |
| 42 | main.c |
| 43 | module.c |
Bjorn Steinbrink | a09ac00 | 2015-01-28 16:35:59 +0000 | [diff] [blame^] | 44 | metadata.c |
Anders Waldenborg | b932c66 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 45 | object.c |
| 46 | targets.c |
| 47 | ) |
NAKAMURA Takumi | f96d423 | 2014-11-10 15:04:26 +0000 | [diff] [blame] | 48 | |
Chris Bieneman | 9ef9c11 | 2014-12-18 21:03:49 +0000 | [diff] [blame] | 49 | if(USE_LLVM_DYLIB) |
NAKAMURA Takumi | f96d423 | 2014-11-10 15:04:26 +0000 | [diff] [blame] | 50 | target_link_libraries(llvm-c-test LLVM) |
| 51 | endif() |