Skip to content

Commit 11cc318

Browse files
committed
Place source and build products in OUT_DIR
This has two benefits: * It follows the directions specified in the Cargo docs. ("Build scripts may save any output files in the directory specified in the `OUT_DIR` environment variable. Scripts should not modify any files outside of that directory.") * It makes `cargo clean` work properly. (When build products are placed outside of `OUT_DIR`, `cargo clean` cannot remove them, which can make issues very difficult to debug.)
1 parent 3696272 commit 11cc318

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() {
3232
_ => variable!("TARGET"),
3333
};
3434
env::remove_var("TARGET");
35-
let source = PathBuf::from(format!("source_{}", target.to_lowercase()));
35+
let source = output.join(format!("source_{}", target.to_lowercase()));
3636
if !source.exists() {
3737
let source_tmp = PathBuf::from(format!("{}_tmp", source.display()));
3838
if source_tmp.exists() {

0 commit comments

Comments
 (0)