Add all library in a path

hey, I know there are these two commands:

println!(r"cargo:rustc-link-search=native=example/path");
println!("cargo:rustc-link-lib=static=libname");

and add statically the "libname" library to my project. but is there a way to add all libraries in a path? and don't print the second command again and again for different lib names?

as far as I know, neither msvc linker or gnu linker support wildcard library input, so I assume the answer is no. you have to list the libraries you want to link against individually.

you can, in your build script, just use std::fs::readdir() to list all the library files under specific directory. or use the glob crate:

https://crates.io/crates/glob

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.