From f6a900fee1397e26c37489a3d434a9a77fbcc30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sat, 5 Jun 2021 23:57:30 +0900 Subject: [PATCH] syntax: Use a different C++ flag for MSVC --- helix-syntax/build.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs index 2e771ea45..a392a033d 100644 --- a/helix-syntax/build.rs +++ b/helix-syntax/build.rs @@ -57,6 +57,13 @@ fn build_c(files: Vec, language: &str) { fn build_cpp(files: Vec, language: &str) { let mut build = cc::Build::new(); + + let flag = if build.get_compiler().is_like_msvc() { + "/std:c++14" + } else { + "-std=c++14" + }; + for file in files { build .file(&file) @@ -64,7 +71,7 @@ fn build_cpp(files: Vec, language: &str) { .pic(true) .warnings(false) .cpp(true) - .flag("-std=c++14"); + .flag_if_supported(flag); } build.compile(&format!("tree-sitter-{}-cpp", language)); }