Skip to content

Commit

Permalink
Fix clang-cl treating file as a /U arg.
Browse files Browse the repository at this point in the history
On MacOS, paths will likely start with /Users, but clang-cl treats /U
as an argument, which leads to the source being mistaken for a flag. To
avoid this, we can pass -- before the source to ensure argument parsing
is disabled.
  • Loading branch information
roblabla committed Mar 31, 2022
1 parent fba7fed commit 781a769
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,10 @@ impl Build {
if self.cuda && self.files.len() > 1 {
cmd.arg("--device-c");
}
// Ensure src is not treated as a clang-cl argument, like /U.
if compiler.family == ToolFamily::Msvc { clang_cl: true } {
cmd.arg("--");
}
cmd.arg(&obj.src);
if cfg!(target_os = "macos") {
self.fix_env_for_apple_os(&mut cmd)?;
Expand Down

0 comments on commit 781a769

Please sign in to comment.