Skip to content

Commit 43415c7

Browse files
committed
build: link against swiftOnoneSupport in debug configuration
When building debug, swift requires a supplementary library. The swift driver is aware of this and will make the appropriate arrangements. However, since the swift component is compacted into the C library, the linker driver being used does not understand this requirement. Explicitly link against the support library. This allows building the debug configuration of libdispatch with a release configuration of the swift standard library.
1 parent 5f49e8b commit 43415c7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if(HAVE_OBJC)
8484
endif()
8585
if(ENABLE_SWIFT)
8686
set(swift_optimization_flags)
87-
if(CMAKE_BUILD_TYPE MATCHES Release)
87+
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
8888
set(swift_optimization_flags -O)
8989
endif()
9090
add_swift_library(swiftDispatch
@@ -121,6 +121,11 @@ if(ENABLE_SWIFT)
121121
PRIVATE
122122
swift/DispatchStubs.cc
123123
${CMAKE_CURRENT_BINARY_DIR}/swiftDispatch.o)
124+
if(CMAKE_BUILD_TYPE MATCHES Debug)
125+
target_link_libraries(dispatch
126+
PRIVATE
127+
swiftSwiftOnoneSupport)
128+
endif()
124129
endif()
125130
if(ENABLE_DTRACE)
126131
dtrace_usdt_probe(${CMAKE_CURRENT_SOURCE_DIR}/provider.d

0 commit comments

Comments
 (0)