Skip to content

Commit

Permalink
Add handling of /Fo option (replaces -o, but shall have no space)
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-gascuel committed Mar 10, 2017
1 parent 375fe24 commit 7e01763
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ccache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7e01763

Please sign in to comment.