From: Jiulong Wang Date: Thu, 3 Aug 2023 12:01:23 +0000 (-0700) Subject: feat: Rewrite path after -Xclang -include to relative (#1318) X-Git-Tag: v4.9~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ba30e24d9022ae3e7ee779450773b804594a58a;p=thirdparty%2Fccache.git feat: Rewrite path after -Xclang -include to relative (#1318) cmake may generate both -include and -include-pch. Example: c++ ... -Xclang -include-pch -Xclang /abs/path/cmake_pch.hxx.pch -Xclang -include -Xclang /abs/path/cmake_pch.hxx ... Both paths needs to be converted to relative path if CCACHE_BASEDIR is set for better cache hit rate in some CI systems. --- diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index a095b7920..279e084e5 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -431,6 +431,7 @@ process_option_arg(const Context& ctx, if (arg == "-Xclang" && i + 1 < args.size() && (args[i + 1] == "-emit-pch" || args[i + 1] == "-emit-pth" || args[i + 1] == "-include-pch" || args[i + 1] == "-include-pth" + || args[i + 1] == "-include" || args[i + 1] == "-fno-pch-timestamp")) { if (compopt_affects_compiler_output(args[i + 1])) { state.compiler_only_args.push_back(args[i]);