]> granicus.if.org Git - clang/blob - tools/c-index-test/CMakeLists.txt
b845af081da6ce6a45ff2000967057b226453963
[clang] / tools / c-index-test / CMakeLists.txt
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     libclang_static
20     clangIndex
21   )
22 else()
23   target_link_libraries(c-index-test
24     libclang
25     clangAST
26     clangBasic
27     clangCodeGen
28     clangFrontend
29     clangIndex
30   )
31 endif()
32
33 set_target_properties(c-index-test
34   PROPERTIES
35   LINKER_LANGUAGE CXX)
36
37 # If libxml2 is available, make it available for c-index-test.
38 if (CLANG_HAVE_LIBXML)
39   include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
40   target_link_libraries(c-index-test ${LIBXML2_LIBRARIES})
41 endif()
42
43 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
44   if(INTERNAL_INSTALL_PREFIX)
45     set(INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/bin")
46     set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
47        "@executable_path/../../lib")
48   else()
49     set(INSTALL_DESTINATION bin)
50   endif()
51
52   install(TARGETS c-index-test
53     RUNTIME DESTINATION "${INSTALL_DESTINATION}"
54     COMPONENT c-index-test)
55
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()
63 endif()