corrosion-rs / corrosion

Marrying Rust and CMake - Easy Rust and C/C++ Integration!
https://corrosion-rs.github.io/corrosion/
MIT License
1.07k stars 103 forks source link

corrosion_link_libraries behavior vs. expectation #505

Open Felix-El opened 5 months ago

Felix-El commented 5 months ago

I found cargo_link_libraries behavior, which according docs is essentially the equivalent to target_link_libraries(), to behave somewhat contrary to expectation.

cargo_link_libraries really just adds -l <lib> and -L <libdir> whereas from target_link_libraries I can at least expect that transitive dependencies are considered (our Rust library might link some FFI).

Additionally, target_link_libraries also supports linking by full path and if a non-target is passed, it is assumed that it is a system library -l <non-target-lib>.

Should not the same be offered by cargo_link_libraries?

jschwe commented 5 months ago

Sure, all of that would be great to have - pull requests are very welcome.