There's no such "install" function in Xcode.
If your program needs a library in order to run, you'll need to either bundle the library with the program or create an installer that copies the library and your application into place.
You can bundle the library with the program by statically linking (effectively not having a library at runtime) - or by embedding. Embedded is explained by Apple here:
https://developer.apple.com/library/archive/technotes/tn2435/_index.html
Usually on development machines, you install internal dependencies such as libraries through the use of build scripts or build steps addded in Xcode. You could simply add a new Build Phase (named "Copy Library" or similar) - and then add a Copy Files step, where you copy your .dylib (or .so or whatever) to the intended destination.