1if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
2  add_definitions( -DEXPORT_LIBLLDB )
3endif()
4
5# Include this so that add_lldb_library() has the list of dependencies
6# for liblldb to link against
7include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
8
9add_lldb_library(liblldb SHARED
10  SBAddress.cpp
11  SBAttachInfo.cpp
12  SBBlock.cpp
13  SBBreakpoint.cpp
14  SBBreakpointLocation.cpp
15  SBBroadcaster.cpp
16  SBCommandInterpreter.cpp
17  SBCommandReturnObject.cpp
18  SBCommunication.cpp
19  SBCompileUnit.cpp
20  SBData.cpp
21  SBDebugger.cpp
22  SBDeclaration.cpp
23  SBError.cpp
24  SBEvent.cpp
25  SBExecutionContext.cpp
26  SBExpressionOptions.cpp
27  SBFileSpec.cpp
28  SBFileSpecList.cpp
29  SBFrame.cpp
30  SBFunction.cpp
31  SBHostOS.cpp
32  SBInstruction.cpp
33  SBInstructionList.cpp
34  SBLanguageRuntime.cpp
35  SBLaunchInfo.cpp
36  SBLineEntry.cpp
37  SBListener.cpp
38  SBModule.cpp
39  SBModuleSpec.cpp
40  SBPlatform.cpp
41  SBProcess.cpp
42  SBQueue.cpp
43  SBQueueItem.cpp
44  SBSection.cpp
45  SBSourceManager.cpp
46  SBStream.cpp
47  SBStringList.cpp
48  SBSymbol.cpp
49  SBSymbolContext.cpp
50  SBSymbolContextList.cpp
51  SBTarget.cpp
52  SBThread.cpp
53  SBThreadCollection.cpp
54  SBThreadPlan.cpp
55  SBType.cpp
56  SBTypeCategory.cpp
57  SBTypeEnumMember.cpp
58  SBTypeFilter.cpp
59  SBTypeFormat.cpp
60  SBTypeNameSpecifier.cpp
61  SBTypeSummary.cpp
62  SBTypeSynthetic.cpp
63  SBValue.cpp
64  SBValueList.cpp
65  SBVariablesOptions.cpp
66  SBWatchpoint.cpp
67  SBUnixSignals.cpp
68  SystemInitializerFull.cpp
69  ${LLDB_WRAP_PYTHON}
70  )
71
72# This should not be part of LLDBDependencies.cmake, because we don't
73# want every single library taking a dependency on the script interpreters.
74target_link_libraries(liblldb PRIVATE
75  lldbPluginScriptInterpreterNone
76  lldbPluginScriptInterpreterPython
77  )
78
79set_target_properties(liblldb
80  PROPERTIES
81  VERSION ${LLDB_VERSION}
82  )
83
84if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
85  if (NOT LLDB_EXPORT_ALL_SYMBOLS)
86    # If we're not exporting all symbols, we'll want to explicitly set
87    # the exported symbols here.  This prevents 'log enable --stack ...'
88    # from working on some systems but limits the liblldb size.
89    MESSAGE("-- Symbols (liblldb): only exporting liblldb.exports symbols")
90    add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
91  else()
92    # Don't use an explicit export.  Instead, tell the linker to
93    # export all symbols.
94    MESSAGE("-- Symbols (liblldb): exporting all symbols")
95    # Darwin linker doesn't need this extra step.
96    if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
97      lldb_append_link_flags(liblldb "-Wl,--export-dynamic")
98    endif()
99  endif()
100endif()
101
102if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
103  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
104  # so only it needs to explicitly link against ${PYTHON_LIBRARY}
105  if (MSVC AND NOT LLDB_DISABLE_PYTHON)
106    target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
107  endif()
108else()
109  set_target_properties(liblldb
110    PROPERTIES
111    OUTPUT_NAME lldb
112    )
113endif()
114
115if (LLDB_WRAP_PYTHON)
116  add_dependencies(liblldb swig_wrapper)
117endif()
118target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
119
120