Skip to content

Commit 120dacb

Browse files
committed
Don't add -isystem header args when --target is specified
1 parent c97ac05 commit 120dacb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/bin/bindgen.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,16 @@ pub fn main() {
199199
bind_args.push("--".to_owned());
200200
}
201201

202-
// TODO: distinguish C and C++ paths? C++'s should be enough, I guess.
203-
for path in clang.cpp_search_paths.into_iter() {
204-
if let Ok(path) = path.into_os_string().into_string() {
205-
bind_args.push("-isystem".to_owned());
206-
bind_args.push(path);
202+
// If --target is specified, assume caller knows what they're doing and don't mess with
203+
// include paths for them
204+
let has_target_arg = bind_args.iter().rposition(|arg| arg.starts_with("--target")).is_some();
205+
if !has_target_arg {
206+
// TODO: distinguish C and C++ paths? C++'s should be enough, I guess.
207+
for path in clang.cpp_search_paths.into_iter() {
208+
if let Ok(path) = path.into_os_string().into_string() {
209+
bind_args.push("-isystem".to_owned());
210+
bind_args.push(path);
211+
}
207212
}
208213
}
209214
}

0 commit comments

Comments
 (0)