Skip to content

Commit 05893a8

Browse files
authored
Merge pull request swiftlang#22831 from compnerd/cmake-modernise-1
cmake: switch host libraries to use `target_link_libraries`
2 parents 3300d1a + 9934532 commit 05893a8

File tree

27 files changed

+127
-123
lines changed

27 files changed

+127
-123
lines changed

lib/AST/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ add_swift_host_library(swiftAST STATIC
6464
TypeWalker.cpp
6565
USRGeneration.cpp
6666

67-
LINK_LIBRARIES
68-
swiftMarkup
69-
swiftBasic
70-
swiftSyntax
71-
7267
INTERFACE_LINK_LIBRARIES
7368
# Clang dependencies.
7469
# FIXME: Clang should really export these in some reasonable manner.
@@ -98,6 +93,10 @@ add_swift_host_library(swiftAST STATIC
9893

9994
${EXTRA_AST_FLAGS}
10095
)
96+
target_link_libraries(swiftAST PRIVATE
97+
swiftBasic
98+
swiftMarkup
99+
swiftSyntax)
101100

102101
# intrinsics_gen is the LLVM tablegen target that generates the include files
103102
# where intrinsics and attributes are declared. swiftAST depends on these

lib/ASTSectionImporter/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_swift_host_library(swiftASTSectionImporter STATIC
22
ASTSectionImporter.cpp
3-
LINK_LIBRARIES swiftBasic
43
LLVM_COMPONENT_DEPENDS core)
4+
target_link_libraries(swiftASTSectionImporter PRIVATE
5+
swiftBasic)
56

lib/Basic/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ add_swift_host_library(swiftBasic STATIC
105105
UnicodeExtendedGraphemeClusters.cpp.gyb
106106

107107
C_COMPILE_FLAGS ${UUID_INCLUDE}
108-
LINK_LIBRARIES
109-
swiftDemangling
110-
${UUID_LIBRARIES}
111108
LLVM_COMPONENT_DEPENDS support)
109+
target_link_libraries(swiftBasic PRIVATE
110+
swiftDemangling
111+
${UUID_LIBRARIES})
112112

113113
message(STATUS "Swift version: ${SWIFT_VERSION}")
114114
message(STATUS "Swift vendor: ${SWIFT_VENDOR}")

lib/ClangImporter/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ add_swift_host_library(swiftClangImporter STATIC
1616
ImportName.cpp
1717
ImportType.cpp
1818
SwiftLookupTable.cpp
19-
LINK_LIBRARIES
20-
swiftAST
21-
swiftParse
2219
)
20+
target_link_libraries(swiftClangImporter PRIVATE
21+
swiftAST
22+
swiftParse)
2323

2424
# This property is only set by calls to clang_tablegen. It will not be set on
2525
# standalone builds, so it can always be safely passed.

lib/Driver/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ set(swiftDriver_targetDefines)
1919

2020
add_swift_host_library(swiftDriver STATIC
2121
${swiftDriver_sources}
22-
DEPENDS SwiftOptions
23-
LINK_LIBRARIES swiftAST swiftBasic swiftOption)
22+
DEPENDS SwiftOptions)
23+
target_link_libraries(swiftDriver PRIVATE
24+
swiftAST
25+
swiftBasic
26+
swiftOption)
2427

2528
# Generate the static-stdlib-args.lnk file used by -static-stdlib option
2629
# for 'GenericUnix' (eg linux)

lib/Frontend/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ add_swift_host_library(swiftFrontend STATIC
1111
PrintingDiagnosticConsumer.cpp
1212
SerializedDiagnosticConsumer.cpp
1313
DEPENDS
14-
SwiftOptions
15-
LINK_LIBRARIES
16-
swiftSIL
17-
swiftMigrator
18-
swiftOption
19-
swiftParseSIL
20-
swiftSILGen
21-
swiftSILOptimizer
22-
swiftSema
23-
swiftSerialization)
14+
SwiftOptions)
15+
target_link_libraries(swiftFrontend PRIVATE
16+
swiftSIL
17+
swiftMigrator
18+
swiftOption
19+
swiftParseSIL
20+
swiftSILGen
21+
swiftSILOptimizer
22+
swiftSema
23+
swiftSerialization)
2424

lib/FrontendTool/CMakeLists.txt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ add_swift_host_library(swiftFrontendTool STATIC
55
TBD.cpp
66
DEPENDS
77
swift-syntax-generated-headers SwiftOptions
8-
LINK_LIBRARIES
9-
swiftIndex
10-
swiftIDE
11-
swiftTBDGen swiftIRGen swiftSIL swiftSILGen swiftSILOptimizer
12-
swiftDemangling
13-
swiftImmediate
14-
swiftSerialization
15-
swiftPrintAsObjC
16-
swiftFrontend
17-
swiftClangImporter
18-
swiftDWARFImporter
19-
swiftOption
208
INTERFACE_LINK_LIBRARIES
219
clangAPINotes
2210
clangBasic
2311
)
12+
target_link_libraries(swiftFrontendTool PRIVATE
13+
swiftClangImporter
14+
swiftDemangling
15+
swiftDWARFImporter
16+
swiftFrontend
17+
swiftIDE
18+
swiftImmediate
19+
swiftIndex
20+
swiftIRGen
21+
swiftOption
22+
swiftPrintAsObjC
23+
swiftSerialization
24+
swiftSIL
25+
swiftSILGen
26+
swiftSILOptimizer
27+
swiftTBDGen)

lib/IDE/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ add_swift_host_library(swiftIDE STATIC
1414
IDETypeChecking.cpp
1515
APIDigesterData.cpp
1616
SourceEntityWalker.cpp
17-
TypeContextInfo.cpp
18-
LINK_LIBRARIES
19-
swiftAST
20-
swiftFrontend
21-
swiftClangImporter
22-
swiftDWARFImporter
23-
swiftParse
24-
swiftSema
25-
swiftIndex)
17+
TypeContextInfo.cpp)
18+
target_link_libraries(swiftIDE PRIVATE
19+
swiftAST
20+
swiftClangImporter
21+
swiftDWARFImporter
22+
swiftFrontend
23+
swiftIndex
24+
swiftParse
25+
swiftSema)
2626

lib/IRGen/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ add_swift_host_library(swiftIRGen STATIC
5050
SwiftTargetInfo.cpp
5151
TypeLayoutDumper.cpp
5252
TypeLayoutVerifier.cpp
53-
LINK_LIBRARIES
54-
swiftAST
55-
swiftLLVMPasses
56-
swiftSIL
57-
swiftSILGen
58-
swiftSILOptimizer
5953

6054
INTERFACE_LINK_LIBRARIES
6155
# Clang dependencies.
@@ -67,3 +61,9 @@ add_swift_host_library(swiftIRGen STATIC
6761
target
6862
transformutils
6963
)
64+
target_link_libraries(swiftIRGen PRIVATE
65+
swiftAST
66+
swiftLLVMPasses
67+
swiftSIL
68+
swiftSILGen
69+
swiftSILOptimizer)

lib/Immediate/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
add_swift_host_library(swiftImmediate STATIC
22
Immediate.cpp
33
REPL.cpp
4-
LINK_LIBRARIES
5-
swiftIDE
6-
swiftFrontend
7-
swiftSILGen
8-
swiftSILOptimizer
9-
swiftIRGen
104
LLVM_COMPONENT_DEPENDS
115
executionengine
126
linker
137
mcjit
148
transformutils)
9+
target_link_libraries(swiftImmediate PRIVATE
10+
swiftFrontend
11+
swiftIDE
12+
swiftIRGen
13+
swiftSILGen
14+
swiftSILOptimizer)
1515

1616
if(HAVE_UNICODE_LIBEDIT)
1717
target_link_libraries(swiftImmediate PRIVATE edit)

0 commit comments

Comments
 (0)