Skip to content

Commit 71fe672

Browse files
committed
llbuildSwift: wire up dependencies only when available
In the case that `Foundation` and `dispatch` are not passed along, wiring up the dependencies results in an injected `-lFoundation.lib` and `-lswiftDispatch.lib` on Windows. Only add the dependencies if we have the associated CMake targets.
1 parent 0b0d140 commit 71fe672

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

products/llbuildSwift/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
4343
else()
4444
target_link_libraries(llbuildSwift PRIVATE
4545
SQLite::SQLite3)
46-
target_link_libraries(llbuildSwift PRIVATE
47-
swiftDispatch
48-
Foundation)
46+
if(dispatch_FOUND)
47+
target_link_libraries(llbuildSwift PRIVATE
48+
swiftDispatch)
49+
endif()
50+
if(Foundation_FOUND)
51+
target_link_libraries(llbuildSwift PRIVATE
52+
Foundation)
53+
endif()
4954
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
5055
target_link_options(llbuildSwift PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
5156
set_target_properties(llbuildSwift PROPERTIES

0 commit comments

Comments
 (0)