diff --git a/src/dune_rules/super_context.ml b/src/dune_rules/super_context.ml index d8061e73bfe6..14120c9c7024 100644 --- a/src/dune_rules/super_context.ml +++ b/src/dune_rules/super_context.ml @@ -10,6 +10,14 @@ let default_context_flags (ctx : Context.t) = let cxx = List.filter c ~f:(fun s -> not (String.is_prefix s ~prefix:"-std=")) in + let c, cxx = + if Lazy.force (Ansi_color.stderr_supports_color) + && Ocaml_config.ccomp_type ctx.ocaml_config <> Msvc then + let colors = "-fdiagnostics-color=always" in + colors :: c, colors :: cxx + else + c, cxx + in Foreign_language.Dict.make ~c ~cxx module Env_tree : sig