Skip to content

Commit d90fae3

Browse files
compnerdktopley-apple
authored andcommitted
build: use the same linker for the tests
We would previously not honor the linker settings for the tests. Adjust the build process to account for that. Signed-off-by: Kim Topley <[email protected]>
1 parent b7a3c55 commit d90fae3

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
cmake_minimum_required(VERSION 3.4.3)
33

4-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
4+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
55

66
project(dispatch
77
VERSION 1.3
@@ -30,6 +30,7 @@ include(CheckLibraryExists)
3030
include(CheckSymbolExists)
3131
include(GNUInstallDirs)
3232
include(SwiftSupport)
33+
include(DispatchUtilities)
3334

3435
set(SWIFT_LIBDIR "lib" CACHE PATH "Library folder name, defined by swift main buildscript")
3536
set(INSTALL_LIBDIR "${SWIFT_LIBDIR}" CACHE PATH "Path where the libraries should be installed")

cmake/modules/DispatchUtilities.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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()

src/CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
212212
"-Xlinker -dead_strip"
213213
"-Xlinker -alias_list -Xlinker ${CMAKE_SOURCE_DIR}/xcodeconfig/libdispatch.aliases")
214214
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)
227216

228217
# Temporary staging; the various swift projects that depend on libdispatch
229218
# all expect libdispatch.so to be in src/.libs/libdispatch.so

0 commit comments

Comments
 (0)