blob: df4884be61d6ad3602d8469f39d53d94a7045ccd [file] [log] [blame]
Douglas Gregor43bc1a72009-09-25 06:35:15 +00001set(SHARED_LIBRARY TRUE)
2
3set(LLVM_NO_RTTI 1)
4
5set(LLVM_USED_LIBS
Douglas Gregor87752492010-01-22 20:35:53 +00006 clangFrontend
Daniel Dunbar845a87b2009-12-02 21:47:55 +00007 clangDriver
8 clangSema
9 clangAnalysis
10 clangAST
11 clangParse
12 clangLex
13 clangBasic)
Douglas Gregor43bc1a72009-09-25 06:35:15 +000014
15set( LLVM_LINK_COMPONENTS
Daniel Dunbar845a87b2009-12-02 21:47:55 +000016 bitreader
17 mc
18 core
Douglas Gregor43bc1a72009-09-25 06:35:15 +000019 )
20
Daniel Dunbard5a2a072010-04-30 21:51:10 +000021add_clang_library(libclang
Ted Kremenek0ec2cca2010-01-05 19:32:54 +000022 CIndex.cpp
Ted Kremenek9cd9f6d2010-01-05 22:06:45 +000023 CIndexCodeCompletion.cpp
Douglas Gregor4f9c3762010-01-28 00:27:43 +000024 CIndexDiagnostic.cpp
Ted Kremenek0b86e3a2010-01-26 19:31:51 +000025 CIndexInclusionStack.cpp
Ted Kremenek9cd9f6d2010-01-05 22:06:45 +000026 CIndexUSRs.cpp
Ted Kremenek0ec2cca2010-01-05 19:32:54 +000027 CIndexer.cpp
Ted Kremenek87553c42010-01-15 20:35:54 +000028 CXCursor.cpp
Douglas Gregor4db30232010-02-18 04:01:41 +000029 ../../include/clang-c/Index.h
Ted Kremenek9cd9f6d2010-01-05 22:06:45 +000030)
Daniel Dunbard5a2a072010-04-30 21:51:10 +000031set_target_properties(libclang PROPERTIES OUTPUT_NAME clang)
Douglas Gregor43bc1a72009-09-25 06:35:15 +000032
33if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
34 # FIXME: Deal with LLVM_SUBMIT_VERSION?
35
Dan Gohman314ca582010-04-16 04:45:02 +000036 # FIXME: This uses a special darwin-specific exports file in order to
37 # get underscore-prefixed names. It would be better to have build rules
38 # which know how to produce a darwin-suitable exports file from the
39 # regular exports file.
Daniel Dunbard5a2a072010-04-30 21:51:10 +000040 set_target_properties(libclang
Douglas Gregor43bc1a72009-09-25 06:35:15 +000041 PROPERTIES
Daniel Dunbard5a2a072010-04-30 21:51:10 +000042 LINK_FLAGS "-avoid-version -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_SOURCE_DIR}/libclang.darwin.exports -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000"
Douglas Gregor43bc1a72009-09-25 06:35:15 +000043 INSTALL_NAME_DIR "@executable_path/../lib"
44 )
45endif()
Douglas Gregor629f4812009-10-05 22:25:29 +000046
Benjamin Kramera2590862009-10-18 19:59:44 +000047if(MSVC)
48 # windows.h doesn't compile with /Za
49 get_target_property(NON_ANSI_COMPILE_FLAGS CIndex COMPILE_FLAGS)
50 string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
Daniel Dunbard5a2a072010-04-30 21:51:10 +000051 set_target_properties(libclang PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
Benjamin Kramera2590862009-10-18 19:59:44 +000052endif(MSVC)
53
Daniel Dunbard5a2a072010-04-30 21:51:10 +000054set_target_properties(libclang
Douglas Gregor629f4812009-10-05 22:25:29 +000055 PROPERTIES
Kovarththanan Rajaratnama0170202010-03-22 15:44:38 +000056 LINKER_LANGUAGE CXX
57 DEFINE_SYMBOL _CINDEX_LIB_)