use std::fs; fn main() { for f in fs::read_dir("src").unwrap() { let os_str_name = f.unwrap().file_name(); let name = os_str_name.to_string_lossy(); println!( "cargo:rustc-cfg={}", name.strip_suffix(".rs").unwrap_or(&name), ); } }