blob: d1d99726cce1020fafe5805167d6864a59642a53 [file] [log] [blame]
Douglas Gregor43bc1a72009-09-25 06:35:15 +00001set(SHARED_LIBRARY TRUE)
2
3set(LLVM_NO_RTTI 1)
4
Michael J. Spencer09476212010-09-13 23:54:41 +00005set(LLVM_USED_LIBS
6 clangFrontend
7 clangDriver
8 clangSerialization
9 clangIndex
10 clangSema
11 clangAST
12 clangLex
13 clangBasic)
14
15set( LLVM_LINK_COMPONENTS
16 bitreader
17 mc
18 core
19 )
20
Daniel Dunbard5a2a072010-04-30 21:51:10 +000021add_clang_library(libclang
Ted Kremenek0ec2cca2010-01-05 19:32:54 +000022 CIndex.cpp
Ted Kremenekae9e2212010-08-27 21:34:58 +000023 CIndexCXX.cpp
Ted Kremenek9cd9f6d2010-01-05 22:06:45 +000024 CIndexCodeCompletion.cpp
Douglas Gregor4f9c3762010-01-28 00:27:43 +000025 CIndexDiagnostic.cpp
Ted Kremenek0b86e3a2010-01-26 19:31:51 +000026 CIndexInclusionStack.cpp
Ted Kremenek9cd9f6d2010-01-05 22:06:45 +000027 CIndexUSRs.cpp
Ted Kremenek0ec2cca2010-01-05 19:32:54 +000028 CIndexer.cpp
Ted Kremenek87553c42010-01-15 20:35:54 +000029 CXCursor.cpp
Ted Kremenek4b4f3692010-11-16 01:56:27 +000030 CXString.cpp
Ted Kremeneka5940822010-08-26 01:42:22 +000031 CXType.cpp
Douglas Gregor4db30232010-02-18 04:01:41 +000032 ../../include/clang-c/Index.h
Michael J. Spencer09476212010-09-13 23:54:41 +000033)
Douglas Gregor43bc1a72009-09-25 06:35:15 +000034
35if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Douglas Gregorb1cf1ca2010-08-02 20:52:32 +000036 # dylib versioning information
37 # FIXME: Is there a more CMake-ish way to handle this?
Michael J. Spencer09476212010-09-13 23:54:41 +000038 set(LIBCLANG_VERSION 1
Douglas Gregorb1cf1ca2010-08-02 20:52:32 +000039 CACHE STRING "Version number of the libclang library")
40 set(LIBCLANG_SUBVERSION 0
41 CACHE STRING "Minor version number of the libclang library")
Michael J. Spencer09476212010-09-13 23:54:41 +000042 set(LIBCLANG_LINK_FLAGS
Douglas Gregorb1cf1ca2010-08-02 20:52:32 +000043 "-Wl,-current_version -Wl,${LIBCLANG_VERSION}.${LIBCLANG_SUBVERSION} -Wl,-compatibility_version -Wl,1")
Douglas Gregor43bc1a72009-09-25 06:35:15 +000044
Michael J. Spencer09476212010-09-13 23:54:41 +000045 set(LIBCLANG_LINK_FLAGS
Douglas Gregorefcc6da2010-08-06 11:08:45 +000046 "${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
Douglas Gregorb1cf1ca2010-08-02 20:52:32 +000047
Daniel Dunbard5a2a072010-04-30 21:51:10 +000048 set_target_properties(libclang
Douglas Gregor43bc1a72009-09-25 06:35:15 +000049 PROPERTIES
Douglas Gregorb1cf1ca2010-08-02 20:52:32 +000050 LINK_FLAGS "${LIBCLANG_LINK_FLAGS}"
51 INSTALL_NAME_DIR "@executable_path/../lib")
Douglas Gregor43bc1a72009-09-25 06:35:15 +000052endif()
Douglas Gregor629f4812009-10-05 22:25:29 +000053
Benjamin Kramera2590862009-10-18 19:59:44 +000054if(MSVC)
55 # windows.h doesn't compile with /Za
Daniel Dunbar832fc4a2010-05-01 00:06:42 +000056 get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
Benjamin Kramera2590862009-10-18 19:59:44 +000057 string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
Daniel Dunbard5a2a072010-04-30 21:51:10 +000058 set_target_properties(libclang PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
Benjamin Kramera2590862009-10-18 19:59:44 +000059endif(MSVC)
60
Daniel Dunbard5a2a072010-04-30 21:51:10 +000061set_target_properties(libclang
Douglas Gregor629f4812009-10-05 22:25:29 +000062 PROPERTIES
Kovarththanan Rajaratnama0170202010-03-22 15:44:38 +000063 LINKER_LANGUAGE CXX
64 DEFINE_SYMBOL _CINDEX_LIB_)