Skip to content

Commit 799eb63

Browse files
committed
[CMake] Make SourceKit respect link_libraries and library_search_directories
add_sourcekit_default_compiler_flags was invoking _add_variant_link_flags and getting link flags but not actually using the link_libraries or library_search_directories. In android builds, this means that the correct libc++ is not being linked against.
1 parent 4dcea1c commit 799eb63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ function(add_sourcekit_default_compiler_flags target)
6666
ENABLE_LTO "${SWIFT_TOOLS_ENABLE_LTO}"
6767
LTO_OBJECT_NAME "${target}-${sdk}-${arch}"
6868
ANALYZE_CODE_COVERAGE "${analyze_code_coverage}"
69-
RESULT_VAR_NAME link_flags)
69+
RESULT_VAR_NAME link_flags
70+
LINK_LIBRARIES_VAR_NAME link_libraries
71+
LIBRARY_SEARCH_DIRECTORIES_VAR_NAME library_search_directories)
7072

7173
# Convert variables to space-separated strings.
7274
_list_escape_for_shell("${c_compile_flags}" c_compile_flags)
@@ -77,6 +79,8 @@ function(add_sourcekit_default_compiler_flags target)
7779
COMPILE_FLAGS " ${c_compile_flags} -fblocks")
7880
set_property(TARGET "${target}" APPEND_STRING PROPERTY
7981
LINK_FLAGS " ${link_flags}")
82+
set_property(TARGET "${target}" APPEND PROPERTY LINK_LIBRARIES ${link_libraries})
83+
swift_target_link_search_directories("${target}" "${library_search_directories}")
8084
endfunction()
8185

8286
# Add a new SourceKit library.

0 commit comments

Comments
 (0)