Honor Cargo's target directory when building LIBPATH
Honor Cargo's target directory when building LIBPATH

Running the tests with “cargo test --target-dir <path>” fails because
"target/" doesn't exist.

Rust 1.57.0 added $CARGO_TARGET_TMPDIR as a scratch directory for
integration tests to use, which Cargo itself won't touch.

Therefore, use $CARGO_TARGET_TMPDIR if it's available, $CARGO_TARGET_DIR
otherwise, and fallback to "target" as a last resort.

nagisa/rust_libloading