File tree Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ include(CheckLibraryExists)
30
30
include (CheckSymbolExists )
31
31
include (GNUInstallDirs )
32
32
include (SwiftSupport )
33
+ include (DispatchUtilities )
33
34
34
35
set (SWIFT_LIBDIR "lib" CACHE PATH "Library folder name, defined by swift main buildscript" )
35
36
set (INSTALL_LIBDIR "${SWIFT_LIBDIR} " CACHE PATH "Path where the libraries should be installed" )
Original file line number Diff line number Diff line change
1
+
2
+ function (dispatch_set_linker target )
3
+ if (USE_GOLD_LINKER )
4
+ set_property (TARGET ${target}
5
+ APPEND_STRING
6
+ PROPERTY LINK_FLAGS
7
+ -fuse-ld=gold )
8
+ endif ()
9
+ if (USE_LLD_LINKER )
10
+ set_property (TARGET ${target}
11
+ APPEND_STRING
12
+ PROPERTY LINK_FLAGS
13
+ -fuse-ld=lld )
14
+ endif ()
15
+ endfunction ()
Original file line number Diff line number Diff line change @@ -212,18 +212,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
212
212
"-Xlinker -dead_strip"
213
213
"-Xlinker -alias_list -Xlinker ${CMAKE_SOURCE_DIR} /xcodeconfig/libdispatch.aliases" )
214
214
endif ()
215
- if (USE_GOLD_LINKER )
216
- set_property (TARGET dispatch
217
- APPEND_STRING
218
- PROPERTY LINK_FLAGS
219
- -fuse-ld=gold )
220
- endif ()
221
- if (USE_LLD_LINKER )
222
- set_property (TARGET dispatch
223
- APPEND_STRING
224
- PROPERTY LINK_FLAGS
225
- -fuse-ld=lld )
226
- endif ()
215
+ dispatch_set_linker (dispatch )
227
216
228
217
# Temporary staging; the various swift projects that depend on libdispatch
229
218
# all expect libdispatch.so to be in src/.libs/libdispatch.so
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ endif()
23
23
24
24
add_executable (bsdtestharness
25
25
bsdtestharness.c )
26
+ dispatch_set_linker (bsdtestharness )
26
27
target_include_directories (bsdtestharness
27
28
PRIVATE
28
29
${CMAKE_CURRENT_BINARY_DIR}
@@ -84,6 +85,7 @@ function(add_unit_test name)
84
85
target_compile_options (${name} PRIVATE -fblocks )
85
86
# TODO(compnerd) make this portable
86
87
target_compile_options (${name} PRIVATE -Wall -Wno-deprecated-declarations )
88
+ dispatch_set_linker (${name} )
87
89
target_link_libraries (${name} PRIVATE dispatch Threads::Threads )
88
90
if (WITH_BLOCKS_RUNTIME )
89
91
target_link_libraries (${name} PRIVATE BlocksRuntime )
You can’t perform that action at this time.
0 commit comments