-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AddSwift.cmake's link_search_directories issues breaking Android compilation. #6488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1109,7 +1110,7 @@ function(_add_swift_library_single target name) | |||
COMPILE_FLAGS " ${c_compile_flags}") | |||
set_property(TARGET "${target}" APPEND_STRING PROPERTY | |||
LINK_FLAGS " ${link_flags}") | |||
swift_target_link_search_directories(${target} ${library_search_directories}) | |||
swift_target_link_search_directories("${target}" "${library_search_directories}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why quote ${target}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw target quoted in multiple calls to add_dependencies
, add_custom_command_target
, add_library
, _set_target_prefix_and_suffix
, target_include_directories
, set_target_properties
among others. But you're right, there's no specific need for it as targets are not supposed to handle spaces, and multiple pieces of code lack of support of multi-target handling on the same call.
@@ -1165,8 +1166,7 @@ function(_add_swift_library_single target name) | |||
"${SWIFTSTATICLIB_DIR}/${SWIFTLIB_SINGLE_SUBDIR}" | |||
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFTLIB_SINGLE_SUBDIR}" | |||
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_LIB_SUBDIR}") | |||
swift_target_link_search_directories(${target_static} | |||
${library_search_directories}) | |||
swift_target_link_search_directories("${target_static}" "${library_search_directories}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why quote the target here?
@@ -1870,8 +1875,7 @@ function(_add_swift_executable_single name) | |||
|
|||
set_property(TARGET ${name} APPEND_STRING PROPERTY | |||
COMPILE_FLAGS " ${c_compile_flags}") | |||
swift_target_link_search_directories(${name} | |||
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}") | |||
swift_target_link_search_directories("${name}" "${library_search_directories}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why quote the target?
@swift-ci please test and merge |
@compnerd I made a mistake on my original contribution. I thought |
I tested this patch, builds for me |
Can you drop the older commits in the set? This is fine as two changes: one to do the variable renaming (if it makes it clearer for others, then its probably worth it) and one to do the appending. |
…earch directories. `LIBRARY_SEARCH_DIRECTORIES` is actually being used as `RESULT_VAR_NAME` to affect the value on the parent scope. In this context `LIBRARY_SEARCH_DIRECTORIES_VAR_NAME` sounds like a better name.
…ecutable_single. Linking directories from `_add_variant_link_flags` of were overwritten in `_add_swift_executable_single` by not using the `LIBRARY_SEARCH_DIRECTORIES` parameter.
…t directory. STLD_FLAGS wasn't being appended, but replaced.
0f37bdf
to
e85e9e1
Compare
Sure. So, I actually made 3 changes. I made the changes you asked but kept the 3rd commit for adding using the output of |
@swift-ci please test and merge |
When
link_search_directories
was added in 6ab6d3 a few issues on the implementation broken the compilation for Android (and potentially other platforms that require adding link search pats).2 fixes and 1 small improvement are included in this PR. Please let me know if I should squash it or change anything.
@compnerd could you please review?
Thanks!