Skip to content
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

Option for whether lib.rs should be rebuilt after build.rs is rerun #1422

Closed
daboross opened this issue Mar 15, 2015 · 3 comments
Closed

Option for whether lib.rs should be rebuilt after build.rs is rerun #1422

daboross opened this issue Mar 15, 2015 · 3 comments

Comments

@daboross
Copy link
Contributor

Currently, whenever build.rs is re-run, both lib.rs and main.rs get rebuilt. It would be useful if there were some option to only rebuild main.rs after build.rs is rerun, not both. This wouldn't want to be the default behaviour, as most build scripts will affect content in lib.rs, but some will only affect main.rs, and an option for that would be nice.

This isn't that urgent, and it may not actually want to be built, but it would probably be useful.

This would probably depend on #1162.

@alexcrichton
Copy link
Member

I believe this is a duplicate of #1162 because Cargo does not currently ever assume that a binary is the location where a native library should be linked if a library is also present. Cargo will instruct the compiler to link the native library to the Rust library and then purposefully not link the native library to the binary generated.

Unfortunately this means that this is not possible for Cargo to know that a build script (or native dependency) is in fact for just a binary, not a library.

@daboross
Copy link
Contributor Author

Would it be possible for this to be a configuration though? I realize it isn't going to be what most people want, but it seems like there would be some projects where build.rs only affects main.rs, not lib.rs (where it is used for something other than native library linking).

@alexcrichton
Copy link
Member

That sounds reasonable to me, I've opened #1430 on the topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants