summaryrefslogtreecommitdiff
path: root/clang/tools/libclang/CMakeLists.txt
blob: fb0b91f00d753e5747c64ad1b72eeafcdb542de5 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
set(LLVM_USED_LIBS
  clangARCMigrate
  clangRewrite
  clangFrontend
  clangDriver
  clangSerialization
  clangSema
  clangEdit
  clangAST
  clangLex
  clangBasic)

set( LLVM_LINK_COMPONENTS
  support
  mc
  )

set(SOURCES
  ARCMigrate.cpp
  CIndex.cpp
  CIndexCXX.cpp
  CIndexCodeCompletion.cpp
  CIndexDiagnostic.cpp
  CIndexDiagnostic.h
  CIndexHigh.cpp
  CIndexInclusionStack.cpp
  CIndexUSRs.cpp
  CIndexer.cpp
  CIndexer.h
  CXCursor.cpp
  CXCursor.h
  CXLoadedDiagnostic.cpp
  CXLoadedDiagnostic.h
  CXSourceLocation.cpp
  CXSourceLocation.h
  CXStoredDiagnostic.cpp
  CXString.cpp
  CXString.h
  CXTranslationUnit.h
  CXType.cpp
  CXType.h
  IndexBody.cpp
  IndexDecl.cpp
  IndexTypeSourceInfo.cpp
  Index_Internal.h
  Indexing.cpp
  IndexingContext.cpp
  IndexingContext.h
  ../../include/clang-c/Index.h
  )

if( LLVM_ENABLE_PIC )
  set(SHARED_LIBRARY TRUE)
  add_clang_library(libclang ${SOURCES})

  set_target_properties(libclang
    PROPERTIES
    OUTPUT_NAME "libclang"
    VERSION ${LIBCLANG_LIBRARY_VERSION}
    DEFINE_SYMBOL _CINDEX_LIB_)

  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    set(LIBCLANG_LINK_FLAGS
      "-Wl,-compatibility_version -Wl,1 -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
    set_target_properties(libclang
      PROPERTIES
      LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
      INSTALL_NAME_DIR "@executable_path/../lib")
  endif()

  if(MSVC)
    # windows.h doesn't compile with /Za
    get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
    string(REPLACE "/Za" "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
    set_target_properties(libclang PROPERTIES
      COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
  endif()

  set(LIBCLANG_STATIC_TARGET_NAME libclang_static)
else()
  set(LIBCLANG_STATIC_TARGET_NAME libclang)
endif()

if( NOT BUILD_SHARED_LIBS AND NOT WIN32 )
  add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})

  set_target_properties(${LIBCLANG_STATIC_TARGET_NAME}
    PROPERTIES
    OUTPUT_NAME "libclang")
endif()