Skip to content

[lldb/cmake] Implicitly pass arguments to llvm_add_library #142583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions lldb/cmake/modules/AddLLDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ function(add_lldb_library name)
${CMAKE_CURRENT_BINARY_DIR}
)

# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
cmake_parse_arguments(PARAM
"MODULE;SHARED;STATIC;OBJECT;PLUGIN;FRAMEWORK;NO_INTERNAL_DEPENDENCIES;NO_PLUGIN_DEPENDENCIES"
"INSTALL_PREFIX;ENTITLEMENTS"
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS;CLANG_LIBS"
"INSTALL_PREFIX"
"EXTRA_CXXFLAGS;LINK_LIBS;CLANG_LIBS"
${ARGN})
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})

if(PARAM_NO_INTERNAL_DEPENDENCIES)
foreach(link_lib ${PARAM_LINK_LIBS})
Expand Down Expand Up @@ -91,19 +88,13 @@ function(add_lldb_library name)
set(libkind STATIC)
endif()

if(PARAM_ENTITLEMENTS)
set(pass_ENTITLEMENTS ENTITLEMENTS ${PARAM_ENTITLEMENTS})
endif()

if(LLDB_NO_INSTALL_DEFAULT_RPATH)
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
endif()

llvm_add_library(${name} ${libkind} ${headers}
${PARAM_UNPARSED_ARGUMENTS}
LINK_LIBS ${PARAM_LINK_LIBS}
DEPENDS ${PARAM_DEPENDS}
${pass_ENTITLEMENTS}
${pass_NO_INSTALL_RPATH}
)

Expand Down Expand Up @@ -169,22 +160,17 @@ endfunction(add_lldb_library)
function(add_lldb_executable name)
cmake_parse_arguments(ARG
"GENERATE_INSTALL"
"INSTALL_PREFIX;ENTITLEMENTS"
"INSTALL_PREFIX"
"LINK_LIBS;CLANG_LIBS;LINK_COMPONENTS;BUILD_RPATH;INSTALL_RPATH"
${ARGN}
)

if(ARG_ENTITLEMENTS)
set(pass_ENTITLEMENTS ENTITLEMENTS ${ARG_ENTITLEMENTS})
endif()

if(LLDB_NO_INSTALL_DEFAULT_RPATH)
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
endif()

list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
add_llvm_executable(${name}
${pass_ENTITLEMENTS}
${pass_NO_INSTALL_RPATH}
${ARG_UNPARSED_ARGUMENTS}
)
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ add_lldb_library(liblldb SHARED ${option_framework}
DEPENDS
lldb-sbapi-dwarf-enums

LINK_COMPONENTS
Support
LINK_LIBS
lldbBreakpoint
lldbCore
Expand All @@ -142,8 +144,6 @@ add_lldb_library(liblldb SHARED ${option_framework}
lldbValueObject
lldbVersion
${LLDB_ALL_PLUGINS}
LINK_COMPONENTS
Support

${option_install_prefix}
)
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Breakpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ add_lldb_library(lldbBreakpoint NO_PLUGIN_DEPENDENCIES
WatchpointOptions.cpp
WatchpointResource.cpp

LINK_COMPONENTS
Support
LINK_LIBS
lldbCore
lldbExpression
Expand All @@ -34,7 +36,4 @@ add_lldb_library(lldbBreakpoint NO_PLUGIN_DEPENDENCIES
lldbTarget
lldbUtility
lldbValueObject

LINK_COMPONENTS
Support
)
5 changes: 2 additions & 3 deletions lldb/source/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
CommandOptionsProcessAttach.cpp
CommandOptionsProcessLaunch.cpp

LINK_COMPONENTS
Support
LINK_LIBS
lldbBreakpoint
lldbCore
Expand All @@ -55,9 +57,6 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
lldbUtility
lldbValueObject
lldbVersion

LINK_COMPONENTS
Support
)

add_dependencies(lldbCommands LLDBOptionsGen)
12 changes: 6 additions & 6 deletions lldb/source/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES
DEPENDS
clang-tablegen-targets


LINK_COMPONENTS
Support
Demangle
TargetParser
Telemetry
LINK_LIBS
lldbBreakpoint
lldbDataFormatters
Expand All @@ -75,12 +81,6 @@ add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES

CLANG_LIBS
clangDriver

LINK_COMPONENTS
Support
Demangle
TargetParser
Telemetry
)

add_dependencies(lldbCore
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/DataFormatters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ add_lldb_library(lldbDataFormatters NO_PLUGIN_DEPENDENCIES
ValueObjectPrinter.cpp
VectorType.cpp

LINK_COMPONENTS
Support
LINK_LIBS
lldbCore
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbValueObject

LINK_COMPONENTS
Support
)
9 changes: 4 additions & 5 deletions lldb/source/Expression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ add_lldb_library(lldbExpression NO_PLUGIN_DEPENDENCIES
DEPENDS
intrinsics_gen

LINK_COMPONENTS
Core
ExecutionEngine
Support
LINK_LIBS
lldbCore
lldbHost
Expand All @@ -28,9 +32,4 @@ add_lldb_library(lldbExpression NO_PLUGIN_DEPENDENCIES
lldbTarget
lldbUtility
lldbValueObject

LINK_COMPONENTS
Core
ExecutionEngine
Support
)
7 changes: 3 additions & 4 deletions lldb/source/Host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,13 @@ endif()
add_lldb_library(lldbHost NO_PLUGIN_DEPENDENCIES
${HOST_SOURCES}

LINK_COMPONENTS
Object
Support
LINK_LIBS
lldbUtility
${EXTRA_LIBS}
${LLDBObjCLibs}
${LLDB_LIBEDIT_LIBS}

LINK_COMPONENTS
Object
Support
)

7 changes: 3 additions & 4 deletions lldb/source/Host/macosx/objcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ add_lldb_library(lldbHostMacOSXObjCXX NO_PLUGIN_DEPENDENCIES
HostThreadMacOSX.mm
MemoryMonitorMacOSX.mm

LINK_LIBS
lldbUtility
${EXTRA_LIBS}

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbUtility
${EXTRA_LIBS}
)

target_compile_options(lldbHostMacOSXObjCXX PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Initialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ add_lldb_library(lldbInitialization
SystemInitializer.cpp
SystemLifetimeManager.cpp

LINK_COMPONENTS
Support
LINK_LIBS
lldbCore
lldbHost
lldbPluginProcessGDBRemote
${EXTRA_PLUGINS}
${LLDB_SYSTEM_LIBS}
LINK_COMPONENTS
Support
)
5 changes: 2 additions & 3 deletions lldb/source/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
Property.cpp
ScriptInterpreter.cpp

LINK_COMPONENTS
Support
LINK_LIBS
lldbInterpreterInterfaces
lldbCommands
Expand All @@ -63,9 +65,6 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
lldbHost
lldbTarget
lldbUtility

LINK_COMPONENTS
Support
)

add_dependencies(lldbInterpreter
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Interpreter/Interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
add_lldb_library(lldbInterpreterInterfaces NO_PLUGIN_DEPENDENCIES
ScriptedInterfaceUsages.cpp

LINK_LIBS
lldbUtility

LINK_COMPONENTS
Support
LINK_LIBS
lldbUtility
)

6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ add_lldb_library(lldbPluginABIAArch64 PLUGIN
ABIMacOSX_arm64.cpp
ABISysV_arm64.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/ARC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
add_lldb_library(lldbPluginABIARC PLUGIN
ABISysV_arc.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbPluginProcessUtility
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/ARM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ add_lldb_library(lldbPluginABIARM PLUGIN
ABIMacOSX_arm.cpp
ABISysV_arm.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbPluginProcessUtility
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/Hexagon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
add_lldb_library(lldbPluginABIHexagon PLUGIN
ABISysV_hexagon.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/LoongArch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
add_lldb_library(lldbPluginABILoongArch PLUGIN
ABISysV_loongarch.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbPluginProcessUtility
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
add_lldb_library(lldbPluginABIMSP430 PLUGIN
ABISysV_msp430.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)

6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/Mips/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ add_lldb_library(lldbPluginABIMips PLUGIN
ABISysV_mips.cpp
ABISysV_mips64.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
6 changes: 3 additions & 3 deletions lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ add_lldb_library(lldbPluginABIPowerPC PLUGIN
ABISysV_ppc.cpp
ABISysV_ppc64.cpp

LINK_COMPONENTS
Support
TargetParser
LINK_LIBS
lldbCore
lldbSymbol
lldbTarget
lldbPluginTypeSystemClang
lldbValueObject
LINK_COMPONENTS
Support
TargetParser
)
Loading
Loading