Skip to content

Commit 2c4f677

Browse files
authored
[lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)
If we're not touching them, we don't need to do anything special to pass them along -- with one important caveat: due to how cmake arguments work, the implicitly passed arguments need to be specified before arguments that we handle. This isn't particularly nice, but the alternative is enumerating all arguments that can be used by llvm_add_library and the macros it calls (it also relies on implicit passing of some arguments to llvm_process_sources).
1 parent 159de36 commit 2c4f677

File tree

128 files changed

+342
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+342
-388
lines changed

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ function(add_lldb_library name)
3838
${CMAKE_CURRENT_BINARY_DIR}
3939
)
4040

41-
# only supported parameters to this macro are the optional
42-
# MODULE;SHARED;STATIC library type and source files
4341
cmake_parse_arguments(PARAM
4442
"MODULE;SHARED;STATIC;OBJECT;PLUGIN;FRAMEWORK;NO_INTERNAL_DEPENDENCIES;NO_PLUGIN_DEPENDENCIES"
45-
"INSTALL_PREFIX;ENTITLEMENTS"
46-
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS;CLANG_LIBS"
43+
"INSTALL_PREFIX"
44+
"EXTRA_CXXFLAGS;LINK_LIBS;CLANG_LIBS"
4745
${ARGN})
48-
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
4946

5047
if(PARAM_NO_INTERNAL_DEPENDENCIES)
5148
foreach(link_lib ${PARAM_LINK_LIBS})
@@ -91,19 +88,13 @@ function(add_lldb_library name)
9188
set(libkind STATIC)
9289
endif()
9390

94-
if(PARAM_ENTITLEMENTS)
95-
set(pass_ENTITLEMENTS ENTITLEMENTS ${PARAM_ENTITLEMENTS})
96-
endif()
97-
9891
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
9992
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
10093
endif()
10194

10295
llvm_add_library(${name} ${libkind} ${headers}
10396
${PARAM_UNPARSED_ARGUMENTS}
10497
LINK_LIBS ${PARAM_LINK_LIBS}
105-
DEPENDS ${PARAM_DEPENDS}
106-
${pass_ENTITLEMENTS}
10798
${pass_NO_INSTALL_RPATH}
10899
)
109100

@@ -169,22 +160,17 @@ endfunction(add_lldb_library)
169160
function(add_lldb_executable name)
170161
cmake_parse_arguments(ARG
171162
"GENERATE_INSTALL"
172-
"INSTALL_PREFIX;ENTITLEMENTS"
163+
"INSTALL_PREFIX"
173164
"LINK_LIBS;CLANG_LIBS;LINK_COMPONENTS;BUILD_RPATH;INSTALL_RPATH"
174165
${ARGN}
175166
)
176167

177-
if(ARG_ENTITLEMENTS)
178-
set(pass_ENTITLEMENTS ENTITLEMENTS ${ARG_ENTITLEMENTS})
179-
endif()
180-
181168
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
182169
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
183170
endif()
184171

185172
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
186173
add_llvm_executable(${name}
187-
${pass_ENTITLEMENTS}
188174
${pass_NO_INSTALL_RPATH}
189175
${ARG_UNPARSED_ARGUMENTS}
190176
)

lldb/source/API/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ add_lldb_library(liblldb SHARED ${option_framework}
128128
DEPENDS
129129
lldb-sbapi-dwarf-enums
130130

131+
LINK_COMPONENTS
132+
Support
131133
LINK_LIBS
132134
lldbBreakpoint
133135
lldbCore
@@ -142,8 +144,6 @@ add_lldb_library(liblldb SHARED ${option_framework}
142144
lldbValueObject
143145
lldbVersion
144146
${LLDB_ALL_PLUGINS}
145-
LINK_COMPONENTS
146-
Support
147147

148148
${option_install_prefix}
149149
)

lldb/source/Breakpoint/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ add_lldb_library(lldbBreakpoint NO_PLUGIN_DEPENDENCIES
2626
WatchpointOptions.cpp
2727
WatchpointResource.cpp
2828

29+
LINK_COMPONENTS
30+
Support
2931
LINK_LIBS
3032
lldbCore
3133
lldbExpression
@@ -34,7 +36,4 @@ add_lldb_library(lldbBreakpoint NO_PLUGIN_DEPENDENCIES
3436
lldbTarget
3537
lldbUtility
3638
lldbValueObject
37-
38-
LINK_COMPONENTS
39-
Support
4039
)

lldb/source/Commands/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
4343
CommandOptionsProcessAttach.cpp
4444
CommandOptionsProcessLaunch.cpp
4545

46+
LINK_COMPONENTS
47+
Support
4648
LINK_LIBS
4749
lldbBreakpoint
4850
lldbCore
@@ -55,9 +57,6 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
5557
lldbUtility
5658
lldbValueObject
5759
lldbVersion
58-
59-
LINK_COMPONENTS
60-
Support
6160
)
6261

6362
add_dependencies(lldbCommands LLDBOptionsGen)

lldb/source/Core/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES
6060
DEPENDS
6161
clang-tablegen-targets
6262

63+
64+
LINK_COMPONENTS
65+
Support
66+
Demangle
67+
TargetParser
68+
Telemetry
6369
LINK_LIBS
6470
lldbBreakpoint
6571
lldbDataFormatters
@@ -75,12 +81,6 @@ add_lldb_library(lldbCore NO_PLUGIN_DEPENDENCIES
7581

7682
CLANG_LIBS
7783
clangDriver
78-
79-
LINK_COMPONENTS
80-
Support
81-
Demangle
82-
TargetParser
83-
Telemetry
8484
)
8585

8686
add_dependencies(lldbCore

lldb/source/DataFormatters/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ add_lldb_library(lldbDataFormatters NO_PLUGIN_DEPENDENCIES
1818
ValueObjectPrinter.cpp
1919
VectorType.cpp
2020

21+
LINK_COMPONENTS
22+
Support
2123
LINK_LIBS
2224
lldbCore
2325
lldbInterpreter
2426
lldbSymbol
2527
lldbTarget
2628
lldbUtility
2729
lldbValueObject
28-
29-
LINK_COMPONENTS
30-
Support
3130
)

lldb/source/Expression/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ add_lldb_library(lldbExpression NO_PLUGIN_DEPENDENCIES
2020
DEPENDS
2121
intrinsics_gen
2222

23+
LINK_COMPONENTS
24+
Core
25+
ExecutionEngine
26+
Support
2327
LINK_LIBS
2428
lldbCore
2529
lldbHost
@@ -28,9 +32,4 @@ add_lldb_library(lldbExpression NO_PLUGIN_DEPENDENCIES
2832
lldbTarget
2933
lldbUtility
3034
lldbValueObject
31-
32-
LINK_COMPONENTS
33-
Core
34-
ExecutionEngine
35-
Support
3635
)

lldb/source/Host/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,13 @@ endif()
177177
add_lldb_library(lldbHost NO_PLUGIN_DEPENDENCIES
178178
${HOST_SOURCES}
179179

180+
LINK_COMPONENTS
181+
Object
182+
Support
180183
LINK_LIBS
181184
lldbUtility
182185
${EXTRA_LIBS}
183186
${LLDBObjCLibs}
184187
${LLDB_LIBEDIT_LIBS}
185-
186-
LINK_COMPONENTS
187-
Object
188-
Support
189188
)
190189

lldb/source/Host/macosx/objcxx/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ add_lldb_library(lldbHostMacOSXObjCXX NO_PLUGIN_DEPENDENCIES
88
HostThreadMacOSX.mm
99
MemoryMonitorMacOSX.mm
1010

11-
LINK_LIBS
12-
lldbUtility
13-
${EXTRA_LIBS}
14-
1511
LINK_COMPONENTS
1612
Support
1713
TargetParser
14+
LINK_LIBS
15+
lldbUtility
16+
${EXTRA_LIBS}
1817
)
1918

2019
target_compile_options(lldbHostMacOSXObjCXX PRIVATE

lldb/source/Initialization/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ add_lldb_library(lldbInitialization
1111
SystemInitializer.cpp
1212
SystemLifetimeManager.cpp
1313

14+
LINK_COMPONENTS
15+
Support
1416
LINK_LIBS
1517
lldbCore
1618
lldbHost
1719
lldbPluginProcessGDBRemote
1820
${EXTRA_PLUGINS}
1921
${LLDB_SYSTEM_LIBS}
20-
LINK_COMPONENTS
21-
Support
2222
)

lldb/source/Interpreter/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
5555
Property.cpp
5656
ScriptInterpreter.cpp
5757

58+
LINK_COMPONENTS
59+
Support
5860
LINK_LIBS
5961
lldbInterpreterInterfaces
6062
lldbCommands
@@ -63,9 +65,6 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
6365
lldbHost
6466
lldbTarget
6567
lldbUtility
66-
67-
LINK_COMPONENTS
68-
Support
6968
)
7069

7170
add_dependencies(lldbInterpreter
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
add_lldb_library(lldbInterpreterInterfaces NO_PLUGIN_DEPENDENCIES
22
ScriptedInterfaceUsages.cpp
33

4-
LINK_LIBS
5-
lldbUtility
6-
74
LINK_COMPONENTS
85
Support
6+
LINK_LIBS
7+
lldbUtility
98
)
109

lldb/source/Plugins/ABI/AArch64/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ add_lldb_library(lldbPluginABIAArch64 PLUGIN
33
ABIMacOSX_arm64.cpp
44
ABISysV_arm64.cpp
55

6+
LINK_COMPONENTS
7+
Support
8+
TargetParser
69
LINK_LIBS
710
lldbCore
811
lldbSymbol
912
lldbTarget
1013
lldbValueObject
11-
LINK_COMPONENTS
12-
Support
13-
TargetParser
1414
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
add_lldb_library(lldbPluginABIARC PLUGIN
22
ABISysV_arc.cpp
33

4+
LINK_COMPONENTS
5+
Support
6+
TargetParser
47
LINK_LIBS
58
lldbCore
69
lldbSymbol
710
lldbTarget
811
lldbPluginProcessUtility
912
lldbValueObject
10-
LINK_COMPONENTS
11-
Support
12-
TargetParser
1313
)

lldb/source/Plugins/ABI/ARM/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ add_lldb_library(lldbPluginABIARM PLUGIN
33
ABIMacOSX_arm.cpp
44
ABISysV_arm.cpp
55

6+
LINK_COMPONENTS
7+
Support
8+
TargetParser
69
LINK_LIBS
710
lldbCore
811
lldbSymbol
912
lldbTarget
1013
lldbPluginProcessUtility
1114
lldbValueObject
12-
LINK_COMPONENTS
13-
Support
14-
TargetParser
1515
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
add_lldb_library(lldbPluginABIHexagon PLUGIN
22
ABISysV_hexagon.cpp
33

4+
LINK_COMPONENTS
5+
Support
6+
TargetParser
47
LINK_LIBS
58
lldbCore
69
lldbSymbol
710
lldbTarget
811
lldbValueObject
9-
LINK_COMPONENTS
10-
Support
11-
TargetParser
1212
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
add_lldb_library(lldbPluginABILoongArch PLUGIN
22
ABISysV_loongarch.cpp
33

4+
LINK_COMPONENTS
5+
Support
6+
TargetParser
47
LINK_LIBS
58
lldbCore
69
lldbSymbol
710
lldbTarget
811
lldbPluginProcessUtility
9-
LINK_COMPONENTS
10-
Support
11-
TargetParser
1212
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
add_lldb_library(lldbPluginABIMSP430 PLUGIN
22
ABISysV_msp430.cpp
33

4+
LINK_COMPONENTS
5+
Support
6+
TargetParser
47
LINK_LIBS
58
lldbCore
69
lldbSymbol
710
lldbTarget
811
lldbValueObject
9-
LINK_COMPONENTS
10-
Support
11-
TargetParser
1212
)
1313

lldb/source/Plugins/ABI/Mips/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ add_lldb_library(lldbPluginABIMips PLUGIN
33
ABISysV_mips.cpp
44
ABISysV_mips64.cpp
55

6+
LINK_COMPONENTS
7+
Support
8+
TargetParser
69
LINK_LIBS
710
lldbCore
811
lldbSymbol
912
lldbTarget
1013
lldbValueObject
11-
LINK_COMPONENTS
12-
Support
13-
TargetParser
1414
)

lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ add_lldb_library(lldbPluginABIPowerPC PLUGIN
33
ABISysV_ppc.cpp
44
ABISysV_ppc64.cpp
55

6+
LINK_COMPONENTS
7+
Support
8+
TargetParser
69
LINK_LIBS
710
lldbCore
811
lldbSymbol
912
lldbTarget
1013
lldbPluginTypeSystemClang
1114
lldbValueObject
12-
LINK_COMPONENTS
13-
Support
14-
TargetParser
1515
)

0 commit comments

Comments
 (0)