Prechádzať zdrojové kódy

Merge topic 'normalize-input-paths'

592e95bbea cmFindPackageCommand: Avoid temporarily saving non-existent result
8d6b76771d find_package: Explicitly normalize CONFIG file path as it exists on disk

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !10096
Brad King 10 mesiacov pred
rodič
commit
fe7b414916
1 zmenil súbory, kde vykonal 6 pridanie a 4 odobranie
  1. 6 4
      Source/cmFindPackageCommand.cxx

+ 6 - 4
Source/cmFindPackageCommand.cxx

@@ -1437,7 +1437,7 @@ bool cmFindPackageCommand::HandlePackageMode(
       // The file location was cached.  Look for the correct file.
       std::string file;
       if (this->FindConfigFile(dir, file)) {
-        this->FileFound = file;
+        this->FileFound = std::move(file);
         fileFound = true;
       }
       def = this->Makefile->GetDefinition(this->Variable);
@@ -2409,9 +2409,9 @@ bool cmFindPackageCommand::CheckDirectory(std::string const& dir)
   }
 
   // Look for the file in this directory.
-  if (this->FindConfigFile(d, this->FileFound)) {
-    // Remove duplicate slashes.
-    cmSystemTools::ConvertToUnixSlashes(this->FileFound);
+  std::string file;
+  if (this->FindConfigFile(d, file)) {
+    this->FileFound = std::move(file);
     return true;
   }
   return false;
@@ -2429,6 +2429,8 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
       // Allow resolving symlinks when the config file is found through a link
       if (this->UseRealPath) {
         file = cmSystemTools::GetRealPath(file);
+      } else {
+        file = cmSystemTools::ToNormalizedPathOnDisk(file);
       }
       return true;
     }