1add_clang_executable(c-index-test
2  c-index-test.c
3  )
4
5if(NOT MSVC)
6  set_property(
7    SOURCE c-index-test.c
8    PROPERTY COMPILE_FLAGS "-std=gnu89"
9    )
10endif()
11
12if (LLVM_BUILD_STATIC)
13  target_link_libraries(c-index-test
14    libclang_static
15  )
16else()
17  target_link_libraries(c-index-test
18    libclang
19  )
20endif()
21
22set_target_properties(c-index-test
23  PROPERTIES
24  LINKER_LANGUAGE CXX)
25
26# If libxml2 is available, make it available for c-index-test.
27if (CLANG_HAVE_LIBXML)
28  include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
29  target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
30endif()
31
32if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
33  if(INTERNAL_INSTALL_PREFIX)
34    set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
35  else()
36    set(INSTALL_DESTINATION bin)
37  endif()
38
39  install(TARGETS c-index-test
40    RUNTIME DESTINATION "${INSTALL_DESTINATION}"
41    COMPONENT c-index-test)
42
43  if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
44    add_custom_target(install-c-index-test
45      DEPENDS c-index-test
46      COMMAND "${CMAKE_COMMAND}"
47              -DCMAKE_INSTALL_COMPONENT=c-index-test
48              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
49  endif()
50endif()
51