[lldb] [cmake] Support linking against clang-cpp dylib

Link against clang-cpp dylib rather than split libs when
CLANG_LINK_CLANG_DYLIB is enabled.

Differential Revision: https://reviews.llvm.org/D68456

llvm-svn: 373734
This commit is contained in:
Michal Gorny 2019-10-04 12:03:03 +00:00
parent 576ea7d1a9
commit 9735739be7
12 changed files with 50 additions and 27 deletions

View File

@ -37,7 +37,7 @@ function(add_lldb_library name)
cmake_parse_arguments(PARAM
"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
"INSTALL_PREFIX;ENTITLEMENTS"
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS;CLANG_LIBS"
${ARGN})
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
@ -91,6 +91,12 @@ function(add_lldb_library name)
${pass_ENTITLEMENTS}
${pass_NO_INSTALL_RPATH}
)
if(CLANG_LINK_CLANG_DYLIB)
target_link_libraries(${name} PRIVATE clang-cpp)
else()
target_link_libraries(${name} PRIVATE ${PARAM_CLANG_LIBS})
endif()
endif()
if(PARAM_SHARED)
@ -136,7 +142,7 @@ function(add_lldb_executable name)
cmake_parse_arguments(ARG
"GENERATE_INSTALL"
"INSTALL_PREFIX;ENTITLEMENTS"
"LINK_LIBS;LINK_COMPONENTS"
"LINK_LIBS;CLANG_LIBS;LINK_COMPONENTS"
${ARGN}
)
@ -156,6 +162,11 @@ function(add_lldb_executable name)
)
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
if(CLANG_LINK_CLANG_DYLIB)
target_link_libraries(${name} PRIVATE clang-cpp)
else()
target_link_libraries(${name} PRIVATE ${ARG_CLANG_LIBS})
endif()
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
if(ARG_GENERATE_INSTALL)

View File

@ -69,7 +69,6 @@ add_lldb_library(lldbCore
clang-tablegen-targets
LINK_LIBS
clangDriver
lldbBreakpoint
lldbDataFormatters
lldbExpression
@ -82,6 +81,9 @@ add_lldb_library(lldbCore
lldbPluginObjCLanguage
${LLDB_CURSES_LIBS}
CLANG_LIBS
clangDriver
LINK_COMPONENTS
Support
Demangle

View File

@ -27,6 +27,16 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN
${tablegen_deps}
LINK_LIBS
lldbCore
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbPluginCPlusPlusLanguage
lldbPluginCPPRuntime
CLANG_LIBS
clangAST
clangCodeGen
clangDriver
@ -38,15 +48,6 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN
clangRewriteFrontend
clangSema
clangSerialization
lldbCore
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbPluginCPlusPlusLanguage
lldbPluginCPPRuntime
LINK_COMPONENTS
Core
ExecutionEngine

View File

@ -22,7 +22,6 @@ add_lldb_library(lldbPluginObjCLanguage PLUGIN
NSString.cpp
LINK_LIBS
clangAST
lldbCore
lldbDataFormatters
lldbExpression
@ -32,6 +31,8 @@ add_lldb_library(lldbPluginObjCLanguage PLUGIN
lldbUtility
lldbPluginAppleObjCRuntime
lldbPluginClangCommon
CLANG_LIBS
clangAST
EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS}
)

View File

@ -9,7 +9,6 @@ add_lldb_library(lldbPluginAppleObjCRuntime PLUGIN
AppleObjCTypeEncodingParser.cpp
LINK_LIBS
clangAST
lldbBreakpoint
lldbCore
lldbExpression
@ -20,6 +19,8 @@ add_lldb_library(lldbPluginAppleObjCRuntime PLUGIN
lldbUtility
lldbPluginExpressionParserClang
lldbPluginCPPRuntime
CLANG_LIBS
clangAST
LINK_COMPONENTS
Support
)

View File

@ -13,7 +13,6 @@ add_lldb_library(lldbPluginRenderScriptRuntime PLUGIN
${tablegen_deps}
LINK_LIBS
clangBasic
lldbBreakpoint
lldbCore
lldbDataFormatters
@ -22,6 +21,8 @@ add_lldb_library(lldbPluginRenderScriptRuntime PLUGIN
lldbInterpreter
lldbSymbol
lldbTarget
CLANG_LIBS
clangBasic
LINK_COMPONENTS
Core
IRReader

View File

@ -39,7 +39,6 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
${PLUGIN_PLATFORM_MACOSX_SOURCES}
LINK_LIBS
clangBasic
lldbBreakpoint
lldbCore
lldbHost
@ -49,6 +48,8 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
lldbUtility
lldbPluginPlatformPOSIX
${OBJC_LIBS}
CLANG_LIBS
clangBasic
LINK_COMPONENTS
Support
)

View File

@ -43,8 +43,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
UniqueDWARFASTType.cpp
LINK_LIBS
clangAST
clangBasic
lldbCore
lldbExpression
lldbHost
@ -55,6 +53,9 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
lldbPluginObjCLanguage
lldbPluginCPlusPlusLanguage
lldbPluginExpressionParserClang
CLANG_LIBS
clangAST
clangBasic
LINK_COMPONENTS
DebugInfoDWARF
Support

View File

@ -11,11 +11,12 @@ add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
UdtRecordCompleter.cpp
LINK_LIBS
clangAST
clangLex
lldbCore
lldbSymbol
lldbUtility
CLANG_LIBS
clangAST
clangLex
LINK_COMPONENTS
DebugInfoCodeView
DebugInfoPDB

View File

@ -4,12 +4,13 @@ add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
SymbolFilePDB.cpp
LINK_LIBS
clangAST
clangLex
lldbCore
lldbPluginSymbolFileNativePDB
lldbSymbol
lldbUtility
lldbPluginSymbolFileNativePDB
CLANG_LIBS
clangAST
clangLex
LINK_COMPONENTS
DebugInfoPDB
Support

View File

@ -46,9 +46,6 @@ add_lldb_library(lldbSymbol
${PLATFORM_SOURCES}
LINK_LIBS
clangAST
clangBasic
clangFrontend
lldbCore
lldbExpression
lldbHost
@ -60,6 +57,11 @@ add_lldb_library(lldbSymbol
lldbPluginObjCLanguage
lldbPluginObjCRuntime
CLANG_LIBS
clangAST
clangBasic
clangFrontend
LINK_COMPONENTS
Support
)

View File

@ -1,7 +1,7 @@
add_lldb_tool(lldb-instr
Instrument.cpp
LINK_LIBS
CLANG_LIBS
clangAST
clangBasic
clangCodeGen