As in the Build Scripts - The Cargo Book :
-lflag is only passed to the library target of the package, unless there is no library target, in which case it is passed to all targets. This is done because all other targets have an implicit dependency on the library target, and the given library to link should only be included once. This means that if a package has both a library and a binary target, the library has access to the symbols from the given lib, and the binary should access them through the library target’s public API.
I have a library crate and in its
build.rs, I link to a shared library by:
But the shared library is not linked for my examples code. I want the
-l flag to be passed to my code under
/examples folder as well. Is there a way to do that?
Thanks for the help in advance!