-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Fix output_directory support when not used as target property #268
Fix output_directory support when not used as target property #268
Conversation
I need some advice on how to best add test coverage for this. |
I guess CMake doesn't set this property on Instead of complicating the checking part like this PR proposes, I would prefer if Corrosion would initialize the properties as CMake would do. Since respecting OUTPUT_DIRECTORY anyway requires CMake 3.19, I would suggest editing This approach has the advantage of working as expected if (for some reason) a user has two or more
Yes, please
Thats one option. We could also just duplicate the rust package (and have a CMake test project with 2 corrosion_import_crate calls). In my opinion, less logic in |
Thank you for the explanation. The observed behavior makes sense now and I agree about the way of fixing it. I'll look into that. |
I've implemented this now, and it seems to work to some extent. Local on macOS with ninja, I'm having the issue that mysteriously |
Lol, shortly after posting the comment I found the issue. So it's passing locally now. |
I guess the remaining failures are due to lack of support for |
Ok, at least the CI is green now :-). |
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.
Looks good now. Thanks for fixing this!
You mentioned you wanted to squash, so I'll wait for that before merging.
In CMake, for example RUNTIME_OUTPUT_DIRECTORY is a target property. It is documented to be initialized from CMAKE_RUNTIME_OUTPUT_DIRECTORY, so it's not unusual for CMake projects to just set the latter variable in order to place all affected targets into the directory, instead of setting a per-target property on each manually. Since Corrosion respects the target property, it makes sense to assume that just setting the CMAKE_ variable would also work.
Done :) |
Hm, for some reason GitHub isn't show that force push. |
In CMake, for example RUNTIME_OUTPUT_DIRECTORY is a target property. It is documented to be initialized from CMAKE_RUNTIME_OUTPUT_DIRECTORY, so it's not unusual for CMake projects to just set the latter variable in order to place all affected targets into the directory, instead of setting a per-target property on each manually.
Since Corrosion respects the target property, it makes sense to assume that just setting the CMAKE_ variable would also work. Oddly, the get_property returns -NOTFOUND when only the CMAKE_ variable is set and not the target property. To "work around" that, this patch implements the fallback manually.