Skip to content

Commit 4ff0707

Browse files
author
Harlan
authored
Rename DEPENDS to LINK_LIBS throughout SourceKit (#11228)
Currently, SourceKit's CMake functions all use DEPENDS to specify libraries the targets will link with. This is confusing as it doesn't behave the same way that add_swift behaves, and implies that dependencies are created when there aren't.
1 parent 0b9ad51 commit 4ff0707

File tree

11 files changed

+51
-50
lines changed

11 files changed

+51
-50
lines changed

tools/SourceKit/CMakeLists.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ endfunction()
114114
# Add a new SourceKit library.
115115
#
116116
# Usage:
117-
# add_sourcekit_library(name # Name of the library
118-
# [DEPENDS dep1 ...] # Libraries this library will be linked with
119-
# [TARGET_DEPENDS dep1 ...] # Targets this library depends on
117+
# add_sourcekit_library(name # Name of the library
118+
# [LINK_LIBS dep1 ...] # Libraries this library will be linked with
119+
# [DEPENDS dep1 ...] # Targets this library depends on
120120
# [LLVM_COMPONENT_DEPENDS comp1 ...] # LLVM components this library depends on
121-
# [INSTALL_IN_COMPONENT comp] # The Swift installation component that this library belongs to.
121+
# [INSTALL_IN_COMPONENT comp] # The Swift installation component that this library belongs to.
122122
# [SHARED]
123123
# source1 [source2 source3 ...]) # Sources to add into this library
124124
macro(add_sourcekit_library name)
125125
cmake_parse_arguments(SOURCEKITLIB
126126
"SHARED"
127127
"INSTALL_IN_COMPONENT"
128-
"DEPENDS;TARGET_DEPENDS;LLVM_COMPONENT_DEPENDS"
128+
"LINK_LIBS;DEPENDS;LLVM_COMPONENT_DEPENDS"
129129
${ARGN})
130130
set(srcs ${SOURCEKITLIB_UNPARSED_ARGUMENTS})
131131

@@ -170,23 +170,23 @@ macro(add_sourcekit_library name)
170170
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
171171
endif(LLVM_COMMON_DEPENDS)
172172

173-
if(SOURCEKITLIB_TARGET_DEPENDS)
174-
add_dependencies(${name} ${SOURCEKITLIB_TARGET_DEPENDS})
175-
endif(SOURCEKITLIB_TARGET_DEPENDS)
173+
if(SOURCEKITLIB_DEPENDS)
174+
add_dependencies(${name} ${SOURCEKITLIB_DEPENDS})
175+
endif(SOURCEKITLIB_DEPENDS)
176176

177177
set(prefixed_link_libraries)
178-
foreach(dep ${SOURCEKITLIB_DEPENDS})
178+
foreach(dep ${SOURCEKITLIB_LINK_LIBS})
179179
if("${dep}" MATCHES "^clang")
180180
set(dep "${LLVM_LIBRARY_OUTPUT_INTDIR}/lib${dep}.a")
181181
endif()
182182
list(APPEND prefixed_link_libraries "${dep}")
183183
endforeach()
184-
set(SOURCEKITLIB_DEPENDS "${prefixed_link_libraries}")
184+
set(SOURCEKITLIB_LINK_LIBS "${prefixed_link_libraries}")
185185

186186
if("${libkind}" STREQUAL "SHARED")
187-
target_link_libraries("${name}" PRIVATE ${SOURCEKITLIB_DEPENDS})
187+
target_link_libraries("${name}" PRIVATE ${SOURCEKITLIB_LINK_LIBS})
188188
else()
189-
target_link_libraries("${name}" INTERFACE ${SOURCEKITLIB_DEPENDS})
189+
target_link_libraries("${name}" INTERFACE ${SOURCEKITLIB_LINK_LIBS})
190190
endif()
191191

192192
swift_common_llvm_config(${name} ${SOURCEKITLIB_LLVM_COMPONENT_DEPENDS})
@@ -228,18 +228,18 @@ endmacro()
228228
# Add a new SourceKit executable.
229229
#
230230
# Usage:
231-
# add_sourcekit_executable(name # Name of the executable
232-
# [DEPENDS dep1 ...] # Libraries this executable depends on
233-
# [LLVM_COMPONENT_DEPENDS comp1 ...] # LLVM components this executable
234-
# # depends on
231+
# add_sourcekit_executable(name # Name of the executable
232+
# [LINK_LIBS dep1 ...] # Libraries this executable depends on
233+
# [LLVM_COMPONENT_DEPENDS comp1 ...] # LLVM components this executable
234+
# # depends on
235235
# [EXCLUDE_FROM_ALL] # Whether to exclude this executable from
236236
# # the ALL_BUILD target
237237
# source1 [source2 source3 ...]) # Sources to add into this executable
238238
macro(add_sourcekit_executable name)
239239
cmake_parse_arguments(SOURCEKITEXE
240240
"EXCLUDE_FROM_ALL"
241241
""
242-
"DEPENDS;LLVM_COMPONENT_DEPENDS"
242+
"LINK_LIBS;LLVM_COMPONENT_DEPENDS"
243243
${ARGN})
244244

245245
if (${SOURCEKITEXE_EXCLUDE_FROM_ALL})
@@ -257,7 +257,7 @@ macro(add_sourcekit_executable name)
257257
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
258258
endif()
259259

260-
target_link_libraries(${name} ${SOURCEKITEXE_DEPENDS})
260+
target_link_libraries(${name} ${SOURCEKITEXE_LINK_LIBS})
261261
swift_common_llvm_config(${name} ${SOURCEKITEXE_LLVM_COMPONENT_DEPENDS})
262262
target_link_libraries(${name} ${LLVM_COMMON_LIBS})
263263

@@ -280,14 +280,14 @@ endmacro()
280280
#
281281
# Usage:
282282
# add_sourcekit_framework(name # Name of the framework
283-
# [DEPENDS dep1 ...] # Libraries this framework depends on
283+
# [LINK_LIBS dep1 ...] # Libraries this framework will link with
284284
# [LLVM_COMPONENT_DEPENDS comp1 ...] # LLVM components this framework depends on
285285
# [MODULEMAP modulemap] # Module map file for this framework
286286
# [INSTALL_IN_COMPONENT comp] # The Swift installation component that this framework belongs to.
287287
# source1 [source2 source3 ...]) # Sources to add into this framework
288288
macro(add_sourcekit_framework name)
289289
cmake_parse_arguments(SOURCEKITFW
290-
"" "MODULEMAP;INSTALL_IN_COMPONENT" "DEPENDS;LLVM_COMPONENT_DEPENDS" ${ARGN})
290+
"" "MODULEMAP;INSTALL_IN_COMPONENT" "LINK_LIBS;LLVM_COMPONENT_DEPENDS" ${ARGN})
291291
set(srcs ${SOURCEKITFW_UNPARSED_ARGUMENTS})
292292

293293
set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
@@ -329,7 +329,7 @@ macro(add_sourcekit_framework name)
329329
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
330330
endif(LLVM_COMMON_DEPENDS)
331331

332-
target_link_libraries(${name} PRIVATE ${SOURCEKITFW_DEPENDS})
332+
target_link_libraries(${name} PRIVATE ${SOURCEKITFW_LINK_LIBS})
333333
swift_common_llvm_config(${name} ${SOURCEKITFW_LLVM_COMPONENT_DEPENDS})
334334

335335
if (EXPORTED_SYMBOL_FILE)
@@ -395,12 +395,12 @@ endmacro(add_sourcekit_framework)
395395
# Add a new SourceKit XPC service to a framework.
396396
#
397397
# Usage:
398-
# add_sourcekit_xpc_service(name # Name of the XPC service
399-
# [DEPENDS dep1 ...] # Libraries this service depends on
398+
# add_sourcekit_xpc_service(name # Name of the XPC service
399+
# [LINK_LIBS dep1 ...] # Libraries this service will link with
400400
# [LLVM_COMPONENT_DEPENDS comp1 ...] # LLVM components this service depends on
401-
# source1 [source2 source3 ...]) # Sources to add into this service
401+
# source1 [source2 source3 ...]) # Sources to add into this service
402402
macro(add_sourcekit_xpc_service name framework_target)
403-
cmake_parse_arguments(SOURCEKITXPC "" "" "DEPENDS;LLVM_COMPONENT_DEPENDS" ${ARGN})
403+
cmake_parse_arguments(SOURCEKITXPC "" "" "LINK_LIBS;LLVM_COMPONENT_DEPENDS" ${ARGN})
404404
set(srcs ${SOURCEKITXPC_UNPARSED_ARGUMENTS})
405405

406406
set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
@@ -441,7 +441,7 @@ macro(add_sourcekit_xpc_service name framework_target)
441441
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
442442
endif(LLVM_COMMON_DEPENDS)
443443

444-
target_link_libraries(${name} ${SOURCEKITXPC_DEPENDS})
444+
target_link_libraries(${name} ${SOURCEKITXPC_LINK_LIBS})
445445
swift_common_llvm_config(${name} ${SOURCEKITXPC_LLVM_COMPONENT_DEPENDS})
446446
target_link_libraries(${name} ${LLVM_COMMON_LIBS})
447447

tools/SourceKit/lib/Core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ add_sourcekit_library(SourceKitCore
33
Context.cpp
44
LangSupport.cpp
55
NotificationCenter.cpp
6-
DEPENDS SourceKitSupport
6+
LINK_LIBS SourceKitSupport
77
)

tools/SourceKit/lib/Support/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ endif()
1515

1616
add_sourcekit_library(SourceKitSupport
1717
${SourceKitSupport_sources}
18-
TARGET_DEPENDS swift-syntax-generated-headers
19-
DEPENDS ${SOURCEKIT_SUPPORT_DEPEND}
18+
DEPENDS swift-syntax-generated-headers
19+
LINK_LIBS ${SOURCEKIT_SUPPORT_DEPEND}
2020
)

tools/SourceKit/lib/SwiftLang/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ add_sourcekit_library(SourceKitSwiftLang
88
SwiftIndexing.cpp
99
SwiftLangSupport.cpp
1010
SwiftSourceDocInfo.cpp
11-
TARGET_DEPENDS swift-syntax-generated-headers
12-
DEPENDS SourceKitCore swiftDriver swiftFrontend swiftClangImporter swiftIDE
13-
swiftAST swiftMarkup swiftParse swiftParseSIL swiftSIL swiftSILGen
14-
swiftSILOptimizer swiftIRGen swiftSema swiftBasic swiftSerialization
15-
swiftSyntax swiftOption libcmark_static
11+
DEPENDS swift-syntax-generated-headers
12+
LINK_LIBS
13+
SourceKitCore swiftDriver swiftFrontend swiftClangImporter swiftIDE
14+
swiftAST swiftMarkup swiftParse swiftParseSIL swiftSIL swiftSILGen
15+
swiftSILOptimizer swiftIRGen swiftSema swiftBasic swiftSerialization
16+
swiftSyntax swiftOption libcmark_static
1617
# Clang dependencies.
1718
clangIndex
1819
clangFormat

tools/SourceKit/tools/complete-test/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
2-
set(SOURCEKITD_TEST_DEPEND sourcekitdInProc)
2+
set(SOURCEKITD_TEST_LINK_LIBS sourcekitdInProc)
33
else()
4-
set(SOURCEKITD_TEST_DEPEND sourcekitd)
4+
set(SOURCEKITD_TEST_LINK_LIBS sourcekitd)
55
endif()
66

77
if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
8-
set(SOURCEKITD_TEST_DEPEND ${SOURCEKITD_TEST_DEPEND} dispatch swiftCore)
8+
set(SOURCEKITD_TEST_LINK_LIBS ${SOURCEKITD_TEST_LINK_LIBS} dispatch swiftCore)
99
endif()
1010

1111
add_sourcekit_executable(complete-test
1212
complete-test.cpp
13-
DEPENDS ${SOURCEKITD_TEST_DEPEND}
13+
LINK_LIBS ${SOURCEKITD_TEST_LINK_LIBS}
1414
LLVM_COMPONENT_DEPENDS support option coverage lto
1515
)
1616

tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ check_symbol_exists(el_wgets "histedit.h" HAVE_UNICODE_LIBEDIT)
33

44
if(HAVE_UNICODE_LIBEDIT)
55
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
6-
set(SOURCEKITD_REPL_DEPEND sourcekitdInProc)
6+
set(SOURCEKITD_REPL_LINK_LIBS sourcekitdInProc)
77
else()
8-
set(SOURCEKITD_REPL_DEPEND sourcekitd)
8+
set(SOURCEKITD_REPL_LINK_LIBS sourcekitd)
99
endif()
1010

1111
if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
12-
set(SOURCEKITD_REPL_DEPEND ${SOURCEKITD_REPL_DEPEND} dispatch swiftCore)
12+
set(SOURCEKITD_REPL_LINK_LIBS ${SOURCEKITD_REPL_LINK_LIBS} dispatch swiftCore)
1313
endif()
1414

1515
add_sourcekit_executable(sourcekitd-repl
1616
sourcekitd-repl.cpp
17-
DEPENDS ${SOURCEKITD_REPL_DEPEND} edit
17+
LINK_LIBS ${SOURCEKITD_REPL_LINK_LIBS} edit
1818
LLVM_COMPONENT_DEPENDS support coverage lto
1919
)
2020

tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ swift_tablegen(Options.inc -gen-opt-parser-defs)
33
swift_add_public_tablegen_target(sourcekitdTestOptionsTableGen)
44

55
if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY)
6-
set(SOURCEKITD_TEST_DEPEND sourcekitdInProc)
6+
set(SOURCEKITD_TEST_LINK_LIBS sourcekitdInProc)
77
else()
8-
set(SOURCEKITD_TEST_DEPEND sourcekitd)
8+
set(SOURCEKITD_TEST_LINK_LIBS sourcekitd)
99
endif()
1010

1111
if(SOURCEKIT_NEED_EXPLICIT_LIBDISPATCH)
12-
set(SOURCEKITD_TEST_DEPEND ${SOURCEKITD_TEST_DEPEND} dispatch swiftCore)
12+
set(SOURCEKITD_TEST_LINK_LIBS ${SOURCEKITD_TEST_LINK_LIBS} dispatch swiftCore)
1313
endif()
1414

1515
add_sourcekit_executable(sourcekitd-test
1616
sourcekitd-test.cpp
1717
TestOptions.cpp
18-
DEPENDS ${SOURCEKITD_TEST_DEPEND} SourceKitSupport
18+
LINK_LIBS ${SOURCEKITD_TEST_LINK_LIBS} SourceKitSupport
1919
clangRewrite clangLex clangBasic
2020
LLVM_COMPONENT_DEPENDS core support option coverage lto
2121
)

tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ option(SOURCEKITD_BUILD_STATIC_INPROC
55

66
set(sourcekitdInProc_args
77
sourcekitdInProc.cpp
8-
DEPENDS SourceKitSwiftLang sourcekitdAPI
8+
LINK_LIBS SourceKitSwiftLang sourcekitdAPI
99
LLVM_COMPONENT_DEPENDS support coverage
1010
)
1111

tools/SourceKit/tools/sourcekitd/bin/XPC/Client/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(EXPORTED_SYMBOL_FILE "${SOURCEKITD_SOURCE_DIR}/bin/sourcekitd.exports")
1010
add_sourcekit_framework(sourcekitd
1111
${public_headers}
1212
sourcekitd.cpp tracer.cpp
13-
DEPENDS sourcekitdAPI
13+
LINK_LIBS sourcekitdAPI
1414
LLVM_COMPONENT_DEPENDS support
1515
MODULEMAP module.modulemap
1616
INSTALL_IN_COMPONENT sourcekit-xpc-service

tools/SourceKit/tools/sourcekitd/bin/XPC/Service/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
if (NOT SOURCEKIT_INSTALLING_INPROC)
22
add_sourcekit_xpc_service(SourceKitService sourcekitd
33
XPCService.cpp XpcTracing.cpp
4-
DEPENDS SourceKitSwiftLang sourcekitdAPI
4+
LINK_LIBS SourceKitSwiftLang sourcekitdAPI
55
LLVM_COMPONENT_DEPENDS support coverage
66
)
77
endif()

tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ endif()
3131

3232
add_sourcekit_library(sourcekitdAPI
3333
${sourcekitdAPI_sources}
34-
DEPENDS
34+
LINK_LIBS
3535
SourceKitSupport SourceKitSwiftLang
3636
)

0 commit comments

Comments
 (0)