| 1 | set(LLVM_LINK_COMPONENTS |
| 2 | support |
| 3 | ) |
| 4 | |
| 5 | add_clang_executable(c-index-test |
| 6 | c-index-test.c |
| 7 | core_main.cpp |
| 8 | ) |
| 9 | |
| 10 | if(NOT MSVC) |
| 11 | set_property( |
| 12 | SOURCE c-index-test.c |
| 13 | PROPERTY COMPILE_FLAGS "-std=gnu89" |
| 14 | ) |
| 15 | endif() |
| 16 | |
| 17 | if (LLVM_BUILD_STATIC) |
| 18 | target_link_libraries(c-index-test |
| 19 | PRIVATE |
| 20 | libclang_static |
| 21 | clangCodeGen |
| 22 | clangIndex |
| 23 | ) |
| 24 | else() |
| 25 | target_link_libraries(c-index-test |
| 26 | PRIVATE |
| 27 | libclang |
| 28 | clangAST |
| 29 | clangBasic |
| 30 | clangCodeGen |
| 31 | clangFrontend |
| 32 | clangIndex |
| 33 | clangSerialization |
| 34 | ) |
| 35 | endif() |
| 36 | |
| 37 | set_target_properties(c-index-test |
| 38 | PROPERTIES |
| 39 | LINKER_LANGUAGE CXX) |
| 40 | |
| 41 | # If libxml2 is available, make it available for c-index-test. |
| 42 | if (CLANG_HAVE_LIBXML) |
| 43 | if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) |
| 44 | include_directories(SYSTEM ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}) |
| 45 | else() |
| 46 | include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) |
| 47 | endif() |
| 48 | target_link_libraries(c-index-test PRIVATE ${LIBXML2_LIBRARIES}) |
| 49 | endif() |
| 50 | |
| 51 | if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 52 | if(INTERNAL_INSTALL_PREFIX) |
| 53 | set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin") |
| 54 | set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH |
| 55 | "@executable_path/../../lib") |
| 56 | else() |
| 57 | set(INSTALL_DESTINATION bin) |
| 58 | endif() |
| 59 | |
| 60 | install(TARGETS c-index-test |
| 61 | RUNTIME DESTINATION "${INSTALL_DESTINATION}" |
| 62 | COMPONENT c-index-test) |
| 63 | |
| 64 | if (NOT LLVM_ENABLE_IDE) |
| 65 | add_llvm_install_targets(install-c-index-test |
| 66 | DEPENDS c-index-test |
| 67 | COMPONENT c-index-test) |
| 68 | endif() |
| 69 | endif() |
| 70 | |