Skip to content

Commit 6bbecba

Browse files
authored
Merge pull request #270 from dgrove-oss/cmark-swift-linking-options
link swift libraries when building test executables
2 parents 69c8f3e + a718671 commit 6bbecba

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ if(BSD_OVERLAY_FOUND)
3939
${BSD_OVERLAY_LDFLAGS})
4040
endif()
4141

42+
if(CMAKE_SWIFT_RUNTIME_LIBDIR)
43+
target_link_libraries(bsdtestharness
44+
PRIVATE
45+
-L${CMAKE_SWIFT_RUNTIME_LIBDIR} -lswiftCore -lswiftSwiftOnoneSupport
46+
-Wl,-rpath -Wl,${CMAKE_SWIFT_RUNTIME_LIBDIR})
47+
endif()
48+
4249
function(add_unit_test name)
4350
set(options DISABLED_TEST)
4451
set(single_value_args)
@@ -77,6 +84,12 @@ function(add_unit_test name)
7784
PRIVATE
7885
${BSD_OVERLAY_LDFLAGS})
7986
endif()
87+
if(CMAKE_SWIFT_RUNTIME_LIBDIR)
88+
target_link_libraries(${name}
89+
PRIVATE
90+
-L${CMAKE_SWIFT_RUNTIME_LIBDIR} -lswiftCore -lswiftSwiftOnoneSupport
91+
-Wl,-rpath -Wl,${CMAKE_SWIFT_RUNTIME_LIBDIR})
92+
endif()
8093
target_link_libraries(${name} PRIVATE bsdtests)
8194
add_test(NAME ${name}
8295
COMMAND bsdtestharness $<TARGET_FILE:${name}>)

0 commit comments

Comments
 (0)