From: Luboš Luňák Date: Sun, 12 Dec 2021 20:09:40 +0000 (+0100) Subject: fix: Handle MSVC flags -MD[d], -MT[d] and -LT[d] properly (#971) X-Git-Tag: v4.6~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6e841c0c92d4672b5b03ace9c10ded9b88cd2ce;p=thirdparty%2Fccache.git fix: Handle MSVC flags -MD[d], -MT[d] and -LT[d] properly (#971) --- diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index 67dda2c64..85bd80076 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -570,7 +570,8 @@ process_arg(const Context& ctx, return nullopt; } - if (util::starts_with(args[i], "-MQ") || util::starts_with(args[i], "-MT")) { + if ((util::starts_with(args[i], "-MQ") || util::starts_with(args[i], "-MT")) + && config.compiler_type() != CompilerType::cl) { args_info.dependency_target_specified = true; if (args[i].size() == 3) { @@ -592,6 +593,21 @@ process_arg(const Context& ctx, return nullopt; } + // MSVC -MD[d], -MT[d] and -LT[d] options are something different than GCC's + // -MD etc. + if (config.compiler_type() == CompilerType::cl + && (util::starts_with(args[i], "-MD") + || util::starts_with(args[i], "-MDd") + || util::starts_with(args[i], "-MT") + || util::starts_with(args[i], "-MTd") + || util::starts_with(args[i], "-LD") + || util::starts_with(args[i], "-LDd"))) { + // These affect compiler but also #define some things. + state.cpp_args.push_back(args[i]); + state.common_args.push_back(args[i]); + return nullopt; + } + if (args[i] == "-fprofile-arcs") { args_info.profile_arcs = true; state.common_args.push_back(args[i]);