summaryrefslogtreecommitdiffstats
path: root/tools/libclang/CMakeLists.txt
blob: 62c973852dc1eb43028395691fdd0db300193326 (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
set(SHARED_LIBRARY TRUE)

set(LLVM_NO_RTTI 1)

set(LLVM_USED_LIBS
 clangFrontend
  clangDriver
  clangSema
  clangAnalysis
  clangAST
  clangParse
  clangLex
  clangBasic)

set( LLVM_LINK_COMPONENTS
  bitreader
  mc
  core
  )

add_clang_library(libclang
  CIndex.cpp
  CIndexCodeCompletion.cpp
  CIndexDiagnostic.cpp
  CIndexInclusionStack.cpp
  CIndexUSRs.cpp
  CIndexer.cpp
  CXCursor.cpp
  CXTypes.cpp
  ../../include/clang-c/Index.h
)
set_target_properties(libclang PROPERTIES OUTPUT_NAME clang)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  # FIXME: Deal with LLVM_SUBMIT_VERSION?

  # FIXME: This uses a special darwin-specific exports file in order to
  # get underscore-prefixed names. It would be better to have build rules
  # which know how to produce a darwin-suitable exports file from the
  # regular exports file.
  set_target_properties(libclang
    PROPERTIES
    LINK_FLAGS "-avoid-version -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_SOURCE_DIR}/libclang.darwin.exports -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000"
    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(MSVC)

set_target_properties(libclang
  PROPERTIES
  LINKER_LANGUAGE CXX
  DEFINE_SYMBOL _CINDEX_LIB_)
OpenPOWER on IntegriCloud