Argyrios Kyrtzidis | 6fdcb9c | 2016-02-14 06:39:11 +0000 | [diff] [blame] | 1 | set(LLVM_LINK_COMPONENTS |
| 2 | support |
| 3 | ) |
| 4 | |
Michael J. Spencer | 0947621 | 2010-09-13 23:54:41 +0000 | [diff] [blame] | 5 | add_clang_executable(c-index-test |
| 6 | c-index-test.c |
Argyrios Kyrtzidis | 6fdcb9c | 2016-02-14 06:39:11 +0000 | [diff] [blame] | 7 | core_main.cpp |
Michael J. Spencer | 0881f4a | 2010-09-10 21:13:16 +0000 | [diff] [blame] | 8 | ) |
| 9 | |
Dmitri Gribenko | 9fcad094 | 2012-11-07 23:52:25 +0000 | [diff] [blame] | 10 | if(NOT MSVC) |
| 11 | set_property( |
| 12 | SOURCE c-index-test.c |
Rafael Espindola | cf63c0d | 2014-01-08 11:44:42 +0000 | [diff] [blame] | 13 | PROPERTY COMPILE_FLAGS "-std=gnu89" |
Dmitri Gribenko | 9fcad094 | 2012-11-07 23:52:25 +0000 | [diff] [blame] | 14 | ) |
| 15 | endif() |
| 16 | |
Rafael Espindola | 8cbf4a0 | 2014-11-05 14:04:25 +0000 | [diff] [blame] | 17 | if (LLVM_BUILD_STATIC) |
| 18 | target_link_libraries(c-index-test |
| 19 | libclang_static |
Rafael Espindola | 46f68f5 | 2017-02-15 22:19:04 +0000 | [diff] [blame^] | 20 | clangCodeGen |
Argyrios Kyrtzidis | 6fdcb9c | 2016-02-14 06:39:11 +0000 | [diff] [blame] | 21 | clangIndex |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 22 | ) |
Rafael Espindola | 8cbf4a0 | 2014-11-05 14:04:25 +0000 | [diff] [blame] | 23 | else() |
| 24 | target_link_libraries(c-index-test |
| 25 | libclang |
NAKAMURA Takumi | 15c4ce4 | 2016-02-14 09:19:04 +0000 | [diff] [blame] | 26 | clangAST |
| 27 | clangBasic |
Argyrios Kyrtzidis | 5fab854 | 2017-01-29 04:50:35 +0000 | [diff] [blame] | 28 | clangCodeGen |
NAKAMURA Takumi | 15c4ce4 | 2016-02-14 09:19:04 +0000 | [diff] [blame] | 29 | clangFrontend |
Argyrios Kyrtzidis | 6fdcb9c | 2016-02-14 06:39:11 +0000 | [diff] [blame] | 30 | clangIndex |
Argyrios Kyrtzidis | 08155c9 | 2017-01-30 07:11:27 +0000 | [diff] [blame] | 31 | clangSerialization |
Rafael Espindola | 8cbf4a0 | 2014-11-05 14:04:25 +0000 | [diff] [blame] | 32 | ) |
| 33 | endif() |
Chandler Carruth | 28969b4 | 2012-06-21 01:30:21 +0000 | [diff] [blame] | 34 | |
Douglas Gregor | 084a654 | 2009-10-05 22:29:42 +0000 | [diff] [blame] | 35 | set_target_properties(c-index-test |
| 36 | PROPERTIES |
| 37 | LINKER_LANGUAGE CXX) |
Dmitri Gribenko | 740c0fb | 2012-08-07 17:54:38 +0000 | [diff] [blame] | 38 | |
| 39 | # If libxml2 is available, make it available for c-index-test. |
NAKAMURA Takumi | 92eb254 | 2012-12-14 18:30:20 +0000 | [diff] [blame] | 40 | if (CLANG_HAVE_LIBXML) |
NAKAMURA Takumi | 80e373e | 2013-07-09 11:14:30 +0000 | [diff] [blame] | 41 | include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) |
Dmitri Gribenko | 740c0fb | 2012-08-07 17:54:38 +0000 | [diff] [blame] | 42 | target_link_libraries(c-index-test ${LIBXML2_LIBRARIES}) |
| 43 | endif() |
Argyrios Kyrtzidis | e053d44 | 2015-11-12 00:46:57 +0000 | [diff] [blame] | 44 | |
Argyrios Kyrtzidis | f10158c | 2015-11-13 22:41:14 +0000 | [diff] [blame] | 45 | if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 46 | if(INTERNAL_INSTALL_PREFIX) |
| 47 | set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin") |
Argyrios Kyrtzidis | 223838a | 2016-02-20 20:34:55 +0000 | [diff] [blame] | 48 | set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH |
| 49 | "@executable_path/../../lib") |
Argyrios Kyrtzidis | f10158c | 2015-11-13 22:41:14 +0000 | [diff] [blame] | 50 | else() |
| 51 | set(INSTALL_DESTINATION bin) |
| 52 | endif() |
Argyrios Kyrtzidis | 2cab8ee | 2015-11-13 01:46:18 +0000 | [diff] [blame] | 53 | |
Argyrios Kyrtzidis | f10158c | 2015-11-13 22:41:14 +0000 | [diff] [blame] | 54 | install(TARGETS c-index-test |
| 55 | RUNTIME DESTINATION "${INSTALL_DESTINATION}" |
| 56 | COMPONENT c-index-test) |
Argyrios Kyrtzidis | 2cab8ee | 2015-11-13 01:46:18 +0000 | [diff] [blame] | 57 | |
Argyrios Kyrtzidis | f10158c | 2015-11-13 22:41:14 +0000 | [diff] [blame] | 58 | if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's. |
| 59 | add_custom_target(install-c-index-test |
| 60 | DEPENDS c-index-test |
| 61 | COMMAND "${CMAKE_COMMAND}" |
| 62 | -DCMAKE_INSTALL_COMPONENT=c-index-test |
| 63 | -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") |
| 64 | endif() |
Argyrios Kyrtzidis | 2cab8ee | 2015-11-13 01:46:18 +0000 | [diff] [blame] | 65 | endif() |