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