1 set(LLVM_USED_LIBS 2 clangARCMigrate 3 clangRewrite 4 clangFrontend 5 clangDriver 6 clangSerialization 7 clangSema 8 clangEdit 9 clangAST 10 clangLex 11 clangBasic) 12 13 set( LLVM_LINK_COMPONENTS 14 support 15 mc 16 ) 17 18 set(SOURCES 19 ARCMigrate.cpp 20 CIndex.cpp 21 CIndexCXX.cpp 22 CIndexCodeCompletion.cpp 23 CIndexDiagnostic.cpp 24 CIndexDiagnostic.h 25 CIndexHigh.cpp 26 CIndexInclusionStack.cpp 27 CIndexUSRs.cpp 28 CIndexer.cpp 29 CIndexer.h 30 CXCursor.cpp 31 CXCursor.h 32 CXLoadedDiagnostic.cpp 33 CXLoadedDiagnostic.h 34 CXSourceLocation.cpp 35 CXSourceLocation.h 36 CXStoredDiagnostic.cpp 37 CXString.cpp 38 CXString.h 39 CXTranslationUnit.h 40 CXType.cpp 41 CXType.h 42 IndexBody.cpp 43 IndexDecl.cpp 44 IndexTypeSourceInfo.cpp 45 Index_Internal.h 46 Indexing.cpp 47 IndexingContext.cpp 48 IndexingContext.h 49 ../../include/clang-c/Index.h 50 ) 51 52 if( LLVM_ENABLE_PIC ) 53 set(SHARED_LIBRARY TRUE) 54 add_clang_library(libclang ${SOURCES}) 55 56 set_target_properties(libclang 57 PROPERTIES 58 OUTPUT_NAME "libclang" 59 VERSION ${LIBCLANG_LIBRARY_VERSION} 60 DEFINE_SYMBOL _CINDEX_LIB_) 61 62 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 63 set(LIBCLANG_LINK_FLAGS 64 "-Wl,-compatibility_version -Wl,1 -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000") 65 set_target_properties(libclang 66 PROPERTIES 67 LINK_FLAGS "${LIBCLANG_LINK_FLAGS}" 68 INSTALL_NAME_DIR "@executable_path/../lib") 69 endif() 70 71 if(MSVC) 72 # windows.h doesn't compile with /Za 73 get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS) 74 string(REPLACE "/Za" "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) 75 set_target_properties(libclang PROPERTIES 76 COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) 77 endif() 78 79 set(LIBCLANG_STATIC_TARGET_NAME libclang_static) 80 else() 81 set(LIBCLANG_STATIC_TARGET_NAME libclang) 82 endif() 83 84 if( NOT BUILD_SHARED_LIBS AND NOT WIN32 ) 85 add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES}) 86 87 set_target_properties(${LIBCLANG_STATIC_TARGET_NAME} 88 PROPERTIES 89 OUTPUT_NAME "libclang") 90 endif() 91