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