Browse Source

cmGlobalNinjaGenerator: Use forward slashes in clang modmap format on Windows

Issue: #24611
Brad King 2 years ago
parent
commit
6013227230
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Source/cmGlobalNinjaGenerator.cxx

+ 7 - 1
Source/cmGlobalNinjaGenerator.cxx

@@ -2639,7 +2639,13 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
     CxxModuleLocations locs;
     locs.RootDirectory = ".";
     locs.PathForGenerator = [this](std::string path) -> std::string {
-      return this->ConvertToNinjaPath(path);
+      path = this->ConvertToNinjaPath(path);
+#  ifdef _WIN32
+      if (this->IsGCCOnWindows()) {
+        std::replace(path.begin(), path.end(), '\\', '/');
+      }
+#  endif
+      return path;
     };
     locs.BmiLocationForModule =
       [&mod_files](std::string const& logical) -> cm::optional<std::string> {