File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,13 @@ set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR})
31
31
32
32
# TODO(compnerd) swift options
33
33
34
- # TODO(compnerd) consider adding a flag for USE_GOLD_LINKER. Currently, we
35
- # expect the user to specify `-fuse-ld=gold`
34
+ if (CMAKE_SYSTEM_NAME STREQUAL Linux OR
35
+ CMAKE_SYSTEM_NAME STREQUAL Android )
36
+ set (USE_GOLD_LINKER_DEFAULT ON )
37
+ else ()
38
+ set (USE_GOLD_LINKER_DEFAULT OFF )
39
+ endif ()
40
+ option (USE_GOLD_LINKER "use the gold linker" ${USE_GOLD_LINKER_DEFAULT} )
36
41
37
42
option (ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via __thread" ON )
38
43
set (DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE} )
Original file line number Diff line number Diff line change @@ -179,6 +179,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
179
179
"-Xlinker -dead_strip"
180
180
"-Xlinker -alias_list -Xlinker ${CMAKE_SOURCE_DIR} /xcodeconfig/libdispatch.aliases" )
181
181
endif ()
182
+ if (USE_GOLD_LINKER )
183
+ set_property (TARGET dispatch
184
+ APPEND_STRING
185
+ PROPERTY LINK_FLAGS
186
+ -fuse-ld=gold )
187
+ endif ()
182
188
183
189
install (TARGETS
184
190
dispatch
You can’t perform that action at this time.
0 commit comments