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  SBMemoryRegionInfo.cpp
39  SBMemoryRegionInfoList.cpp
40  SBModule.cpp
41  SBModuleSpec.cpp
42  SBPlatform.cpp
43  SBProcess.cpp
44  SBQueue.cpp
45  SBQueueItem.cpp
46  SBSection.cpp
47  SBSourceManager.cpp
48  SBStream.cpp
49  SBStringList.cpp
50  SBSymbol.cpp
51  SBSymbolContext.cpp
52  SBSymbolContextList.cpp
53  SBTarget.cpp
54  SBThread.cpp
55  SBThreadCollection.cpp
56  SBThreadPlan.cpp
57  SBType.cpp
58  SBTypeCategory.cpp
59  SBTypeEnumMember.cpp
60  SBTypeFilter.cpp
61  SBTypeFormat.cpp
62  SBTypeNameSpecifier.cpp
63  SBTypeSummary.cpp
64  SBTypeSynthetic.cpp
65  SBValue.cpp
66  SBValueList.cpp
67  SBVariablesOptions.cpp
68  SBWatchpoint.cpp
69  SBUnixSignals.cpp
70  SystemInitializerFull.cpp
71  ${LLDB_WRAP_PYTHON}
72  )
73
74# This should not be part of LLDBDependencies.cmake, because we don't
75# want every single library taking a dependency on the script interpreters.
76target_link_libraries(liblldb PRIVATE
77  lldbPluginScriptInterpreterNone
78  lldbPluginScriptInterpreterPython
79  )
80
81set_target_properties(liblldb
82  PROPERTIES
83  VERSION ${LLDB_VERSION}
84  )
85
86if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
87  if (NOT LLDB_EXPORT_ALL_SYMBOLS)
88    # If we're not exporting all symbols, we'll want to explicitly set
89    # the exported symbols here.  This prevents 'log enable --stack ...'
90    # from working on some systems but limits the liblldb size.
91    MESSAGE("-- Symbols (liblldb): only exporting liblldb.exports symbols")
92    add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
93  else()
94    # Don't use an explicit export.  Instead, tell the linker to
95    # export all symbols.
96    MESSAGE("-- Symbols (liblldb): exporting all symbols")
97    # Darwin linker doesn't need this extra step.
98    if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
99      lldb_append_link_flags(liblldb "-Wl,--export-dynamic")
100    endif()
101  endif()
102endif()
103
104if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
105  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
106  # so only it needs to explicitly link against ${PYTHON_LIBRARY}
107  if (MSVC AND NOT LLDB_DISABLE_PYTHON)
108    target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
109  endif()
110else()
111  set_target_properties(liblldb
112    PROPERTIES
113    OUTPUT_NAME lldb
114    )
115endif()
116
117if (LLDB_WRAP_PYTHON)
118  add_dependencies(liblldb swig_wrapper)
119endif()
120target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
121
122