-
Notifications
You must be signed in to change notification settings - Fork 441
Temporarily workaround CMake dependencies bug #1081
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
2335b8b
to
67d9a9c
Compare
@swift-ci please test |
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.
It's terrible, but I think it works. A few style comments.
Also, can you add reference to rdar://102202478 in a comment? Thanks.
CC @compnerd any thoughts/feedback?
# part of A. Ideally this file would be generated by each of the targets, but that dependency didn't | ||
# seem to be being tracked. | ||
function(add_forced_dependencies TARGET) | ||
cmake_parse_arguments(ARGS "" "" "PUBLIC" ${ARGN}) |
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.
The naming here feels a bit weird. I'm not getting that it's linking from the function name, and the PUBLIC
seems to come out of nowhere.
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.
So I totally agree about the PUBLIC
, but I was basically just aiming at making it a 1:1 replacement for target_link_libraries
(at least for the case we use it). I don't really mind either way. Do you have a strong opinion here?
How about I rename it to force_target_link_libraries
?
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 actually think that this change is far too invasive for what it intends to do. I think that we should be more clever about this workaround. Please rename this function target_link_librares
. We can subsequently, at the end of the function passthrough to the underlying implementation of target_link_libraries
.
Something like this should do the trick:
function(target_link_libraries target)
cmake_parse_arguments(TLL_ARGS "" "" "PUBLIC" ${ARGN})
foreach(dependency ${TLL_PUBLIC})
...
endforeach()
_target_link_libraries(${target} PUBLIC ${TLL_PUBLIC} ${TLL_ARGN})
endfunction()
This way, in the future, the revert of this will just drop this one function and everything goes back to normal.
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 had no idea you could do that. I've updated the PR to do this instead, but I'll leave the Swift PR as is - once the function is redefined, it's redefined from that point on (not scoped to a subdirectory). This is fine for swift-syntax, but not for the swift-side change (and that only touches the one file anyway). Thanks for the suggestion @compnerd!
67d9a9c
to
9ed7ab0
Compare
@swift-ci please test |
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.
Yeah, I think the new changes are fine given that the goal is to delete the function.
# part of A. Ideally this file would be generated by each of the targets, but that dependency didn't | ||
# seem to be being tracked. | ||
function(add_forced_dependencies TARGET) | ||
cmake_parse_arguments(ARGS "" "" "PUBLIC" ${ARGN}) |
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 actually think that this change is far too invasive for what it intends to do. I think that we should be more clever about this workaround. Please rename this function target_link_librares
. We can subsequently, at the end of the function passthrough to the underlying implementation of target_link_libraries
.
Something like this should do the trick:
function(target_link_libraries target)
cmake_parse_arguments(TLL_ARGS "" "" "PUBLIC" ${ARGN})
foreach(dependency ${TLL_PUBLIC})
...
endforeach()
_target_link_libraries(${target} PUBLIC ${TLL_PUBLIC} ${TLL_ARGN})
endfunction()
This way, in the future, the revert of this will just drop this one function and everything goes back to normal.
Workaround a CMake bug in order to make sure that libraries are rebuilt when their dependencies change.
9ed7ab0
to
8975161
Compare
@swift-ci please test |
Workaround a CMake bug in order to make sure that libraries are rebuilt when their dependencies change.