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