@@ -433,11 +433,12 @@ fn build_tree_sitter_library(
433433 for (key, value) in compiler.env() {
434434 command.env(key, value);
435435 }
436+
436437 command.args(compiler.args());
437438 // used to delay dropping the temporary object file until after the compilation is complete
438439 let _path_guard;
439440
440− if cfg!(all(windows, target_env = "msvc")) {
441+ if compiler.is_like_msvc() {
441442 command
442443 .args(["/nologo", "/LD", "/I"])
443444 .arg(header_path)
@@ -455,20 +456,20 @@ fn build_tree_sitter_library(
455456 }
456457 cpp_command.args(compiler.args());
457458 let object_file =
458− library_path.with_file_name(format!("{}_scanner.o", &grammar.grammar_id));
459+ library_path.with_file_name(format!("{}_scanner.obj", &grammar.grammar_id));
459460 cpp_command
460461 .args(["/nologo", "/LD", "/I"])
461462 .arg(header_path)
462463 .arg("/Od")
463464 .arg("/utf-8")
464465 .arg("/std:c++14")
465− .arg("/o")
466− .arg(&object_file)
466+ .arg(format!("/Fo{}", object_file.display()))
467467 .arg("/c")
468468 .arg(scanner_path);
469469 let output = cpp_command
470470 .output()
471471 .context("Failed to execute C++ compiler")?;
472+
472473 if !output.status.success() {
473474 return Err(anyhow!(
474475 "Parser compilation failed.\nStdout: {}\nStderr: {}",