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