From 7e017632e6c41c657615cf9980e595ec07edbea1 Mon Sep 17 00:00:00 2001 From: jdg Date: Fri, 10 Mar 2017 18:52:51 +0100 Subject: [PATCH] Add handling of /Fo option (replaces -o, but shall have no space) --- ccache.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ccache.c b/ccache.c index 36129c438f..33a6192a7e 100644 --- a/ccache.c +++ b/ccache.c @@ -1166,8 +1166,14 @@ to_cache(struct args *args) free(base_name); } + if (compiler_is_msvc(args)) { + char *fo = format("-Fo%s", output_obj); + args_add(args, fo); + free(fo); + } else { args_add(args, "-o"); args_add(args, output_obj); + } if (output_dia) { args_add(args, "--serialize-diagnostics"); @@ -2394,11 +2400,18 @@ cc_process_args(struct args *args, struct args **preprocessor_args, continue; } - // Alternate form of -o with no space. + // Alternate form of -o/-Fo with no space. + if (compiler_is_msvc(args)) { + if (str_startswith(argv[i], "-Fo")) { + output_obj = make_relative_path(x_strdup(&argv[i][3])); + continue; + } + } else { if (str_startswith(argv[i], "-o")) { output_obj = make_relative_path(x_strdup(&argv[i][2])); continue; } + } if (str_eq(argv[i], "-gsplit-dwarf")) { cc_log("Enabling caching of dwarf files since -gsplit-dwarf is used");