summaryrefslogtreecommitdiff
path: root/utils/ccomp.ml
diff options
context:
space:
mode:
authoralainfrisch <alain@frisch.fr>2016-01-07 18:21:05 +0100
committeralainfrisch <alain@frisch.fr>2016-01-07 18:21:05 +0100
commit2264004cb796bd8c4bc5bdd5119a3dda9282e4e5 (patch)
treebb3b73a059b525195af641f5af6c51a211f77e3b /utils/ccomp.ml
parentee99ed1a04a5f9dde8185dfe3947b625100517ab (diff)
downloadocaml-2264004cb796bd8c4bc5bdd5119a3dda9282e4e5.tar.gz
Fix command-line for MSVC
Avoid warnings when calling the MS C compiler from an OCaml driver: - #7078: Do not pass -g. One could perhaps pass /Zi, but it is not clear this would be useful. - Use /Fo instead of the deprecated -o to specify the output object file,
Diffstat (limited to 'utils/ccomp.ml')
-rw-r--r--utils/ccomp.ml9
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/ccomp.ml b/utils/ccomp.ml
index c89fecabd7..f8b8404979 100644
--- a/utils/ccomp.ml
+++ b/utils/ccomp.ml
@@ -58,10 +58,11 @@ let compile_file ~output_name name =
if !Clflags.native_code
then Config.native_c_compiler
else Config.bytecomp_c_compiler)
- (match output_name with
- | Some n -> " -o " ^ Filename.quote n
- | None -> "")
- (if !Clflags.debug then "-g" else "")
+ (match output_name, Config.ccomp_type with
+ | Some n, "msvc" -> " /Fo" ^ Filename.quote n
+ | Some n, _ -> " -o " ^ Filename.quote n
+ | None, _ -> "")
+ (if !Clflags.debug && Config.ccomp_type <> "msvc" then "-g" else "")
(String.concat " " (List.rev !Clflags.all_ccopts))
(quote_prefixed "-I" (List.rev !Clflags.include_dirs))
(Clflags.std_include_flag "-I")