]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Detect MSVC compiler case insensitive and with exact match
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 23 Jan 2022 19:27:03 +0000 (20:27 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 23 Jan 2022 19:27:03 +0000 (20:27 +0100)
src/ccache.cpp

index 3a8a89d71694232e0d44c1138b7088239fd07565..51da46b6650950b68c0c02f0c5836237529613b0 100644 (file)
@@ -227,7 +227,8 @@ guess_compiler(string_view path)
   }
 #endif
 
-  const string_view name = Util::base_name(compiler_path);
+  const auto name =
+    Util::to_lowercase(Util::remove_extension(Util::base_name(compiler_path)));
   if (name.find("clang") != nonstd::string_view::npos) {
     return CompilerType::clang;
   } else if (name.find("gcc") != nonstd::string_view::npos
@@ -235,7 +236,7 @@ guess_compiler(string_view path)
     return CompilerType::gcc;
   } else if (name.find("nvcc") != nonstd::string_view::npos) {
     return CompilerType::nvcc;
-  } else if (name.find("cl") != nonstd::string_view::npos) {
+  } else if (name == "cl") {
     return CompilerType::msvc;
   } else {
     return CompilerType::other;