]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Add support for MSVC /Tc and /Tp options
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 3 Feb 2024 16:13:12 +0000 (17:13 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 3 Feb 2024 19:51:06 +0000 (20:51 +0100)
Closes #1387.

src/argprocessing.cpp

index a61317e5f7387d8d931c3d3930d0aaa533d938d1..f1a11ab3ab597f5c2c97bbc94bf74e3a7edf6149 100644 (file)
@@ -555,10 +555,19 @@ process_option_arg(const Context& ctx,
     return Statistic::none;
   }
 
-  // MSVC -Fo with no space.
-  if (util::starts_with(arg, "-Fo") && config.is_compiler_group_msvc()) {
-    args_info.output_obj = arg.substr(3);
-    return Statistic::none;
+  if (config.is_compiler_group_msvc()) {
+    // MSVC /Fo with no space.
+    if (util::starts_with(arg, "-Fo")) {
+      args_info.output_obj = arg.substr(3);
+      return Statistic::none;
+    }
+
+    // MSVC /Tc and /Tp options for specifying input file.
+    if (arg.length() > 3 && util::starts_with(arg, "-T")
+        && (arg[2] == 'c' || arg[2] == 'p')) {
+      size_t file_index = arg[3] == ' ' ? 4 : 3;
+      state.input_files.emplace_back(arg.substr(file_index));
+    }
   }
 
   // when using nvcc with separable compilation, -dc implies -c