Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 1 | set(SOURCES |
Argyrios Kyrtzidis | 7fbd97f | 2011-07-09 20:00:58 +0000 | [diff] [blame] | 2 | ARCMigrate.cpp |
Dmitri Gribenko | f430da4 | 2014-02-12 10:33:14 +0000 | [diff] [blame] | 3 | BuildSystem.cpp |
Ted Kremenek | 0ec2cca | 2010-01-05 19:32:54 +0000 | [diff] [blame] | 4 | CIndex.cpp |
Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 5 | CIndexCXX.cpp |
Ted Kremenek | 9cd9f6d | 2010-01-05 22:06:45 +0000 | [diff] [blame] | 6 | CIndexCodeCompletion.cpp |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 7 | CIndexDiagnostic.cpp |
Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 8 | CIndexHigh.cpp |
Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 9 | CIndexInclusionStack.cpp |
Ted Kremenek | 9cd9f6d | 2010-01-05 22:06:45 +0000 | [diff] [blame] | 10 | CIndexUSRs.cpp |
Ted Kremenek | 0ec2cca | 2010-01-05 19:32:54 +0000 | [diff] [blame] | 11 | CIndexer.cpp |
Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 12 | CXComment.cpp |
Ted Kremenek | 87553c4 | 2010-01-15 20:35:54 +0000 | [diff] [blame] | 13 | CXCursor.cpp |
Arnaud A. de Grandmaison | 2b3c860 | 2012-06-30 20:43:43 +0000 | [diff] [blame] | 14 | CXCompilationDatabase.cpp |
Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 15 | CXLoadedDiagnostic.cpp |
Ted Kremenek | 4c4f08d | 2011-10-31 22:05:42 +0000 | [diff] [blame] | 16 | CXSourceLocation.cpp |
Ted Kremenek | bb2c710 | 2011-10-31 21:40:19 +0000 | [diff] [blame] | 17 | CXStoredDiagnostic.cpp |
Ted Kremenek | 4b4f369 | 2010-11-16 01:56:27 +0000 | [diff] [blame] | 18 | CXString.cpp |
Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 19 | CXType.cpp |
Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 20 | IndexBody.cpp |
| 21 | IndexDecl.cpp |
| 22 | IndexTypeSourceInfo.cpp |
| 23 | Indexing.cpp |
| 24 | IndexingContext.cpp |
NAKAMURA Takumi | bf6d1ef | 2014-01-20 10:24:05 +0000 | [diff] [blame] | 25 | |
| 26 | ADDITIONAL_HEADERS |
| 27 | CIndexDiagnostic.h |
| 28 | CIndexer.h |
| 29 | CXCursor.h |
| 30 | CXLoadedDiagnostic.h |
| 31 | CXSourceLocation.h |
| 32 | CXString.h |
| 33 | CXTranslationUnit.h |
| 34 | CXType.h |
| 35 | Index_Internal.h |
Ted Kremenek | bb2c710 | 2011-10-31 21:40:19 +0000 | [diff] [blame] | 36 | IndexingContext.h |
Douglas Gregor | 4db3023 | 2010-02-18 04:01:41 +0000 | [diff] [blame] | 37 | ../../include/clang-c/Index.h |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 38 | ) |
Douglas Gregor | 43bc1a7 | 2009-09-25 06:35:15 +0000 | [diff] [blame] | 39 | |
NAKAMURA Takumi | 742b90c | 2014-01-23 15:33:50 +0000 | [diff] [blame] | 40 | option(LIBCLANG_BUILD_STATIC |
| 41 | "Build libclang as a static library (in addition to a shared one)" OFF) |
| 42 | |
Nico Weber | 5f676dc | 2013-12-29 19:31:48 +0000 | [diff] [blame] | 43 | set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports) |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 44 | |
NAKAMURA Takumi | 9f2538d | 2014-01-22 13:02:59 +0000 | [diff] [blame] | 45 | if(MSVC) |
| 46 | # Avoid LNK4197 not to spceify libclang.def here. |
| 47 | # Each functions is exported as "dllexport" in include/clang-c. |
| 48 | # KB835326 |
| 49 | set(LLVM_EXPORTED_SYMBOL_FILE) |
| 50 | endif() |
| 51 | |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 52 | if( LLVM_ENABLE_PIC ) |
NAKAMURA Takumi | 959c64b | 2014-02-21 15:34:01 +0000 | [diff] [blame^] | 53 | set(ENABLE_SHARED SHARED) |
| 54 | endif() |
Douglas Gregor | b1cf1ca | 2010-08-02 20:52:32 +0000 | [diff] [blame] | 55 | |
NAKAMURA Takumi | 959c64b | 2014-02-21 15:34:01 +0000 | [diff] [blame^] | 56 | if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32) |
| 57 | set(ENABLE_STATIC STATIC) |
| 58 | endif() |
| 59 | |
| 60 | if(WIN32) |
| 61 | set(output_name "libclang") |
| 62 | else() |
| 63 | set(output_name "clang") |
| 64 | endif() |
| 65 | |
| 66 | add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC} |
| 67 | OUTPUT_NAME ${output_name} |
| 68 | ${SOURCES} |
| 69 | DEPENDS clang-headers |
| 70 | |
| 71 | LINK_LIBS |
| 72 | clangARCMigrate |
| 73 | clangAST |
| 74 | clangBasic |
| 75 | clangFrontend |
| 76 | clangIndex |
| 77 | clangLex |
| 78 | clangSema |
| 79 | clangTooling |
| 80 | |
| 81 | LINK_COMPONENTS |
| 82 | BitReader |
| 83 | Support |
| 84 | ) |
| 85 | |
| 86 | if(ENABLE_SHARED) |
Manuel Klimek | 4fa6b60 | 2012-05-15 08:58:48 +0000 | [diff] [blame] | 87 | if(WIN32) |
| 88 | set_target_properties(libclang |
| 89 | PROPERTIES |
Manuel Klimek | 4fa6b60 | 2012-05-15 08:58:48 +0000 | [diff] [blame] | 90 | VERSION ${LIBCLANG_LIBRARY_VERSION} |
| 91 | DEFINE_SYMBOL _CINDEX_LIB_) |
| 92 | else() |
| 93 | set_target_properties(libclang |
| 94 | PROPERTIES |
Manuel Klimek | 4fa6b60 | 2012-05-15 08:58:48 +0000 | [diff] [blame] | 95 | VERSION ${LIBCLANG_LIBRARY_VERSION} |
| 96 | DEFINE_SYMBOL _CINDEX_LIB_) |
| 97 | endif() |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 98 | |
| 99 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
Nico Weber | 194c009 | 2013-12-30 03:43:30 +0000 | [diff] [blame] | 100 | set(LIBCLANG_LINK_FLAGS " -Wl,-compatibility_version -Wl,1") |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 101 | if (DEFINED ${LLVM_SUBMIT_VERSION}) |
| 102 | set(LIBCLANG_LINK_FLAGS |
| 103 | "${LIBCLANG_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_SUBMIT_VERSION}.${LLVM_SUBMIT_SUBVERSION}") |
| 104 | endif() |
| 105 | |
| 106 | set_property(TARGET libclang APPEND_STRING PROPERTY |
| 107 | LINK_FLAGS ${LIBCLANG_LINK_FLAGS}) |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 108 | set_target_properties(libclang |
| 109 | PROPERTIES |
Argyrios Kyrtzidis | 08b0418 | 2013-11-06 08:37:50 +0000 | [diff] [blame] | 110 | INSTALL_NAME_DIR "@rpath") |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 111 | endif() |
Oscar Fuentes | 7221610 | 2011-03-13 15:10:24 +0000 | [diff] [blame] | 112 | endif() |