Prechádzať zdrojové kódy

PCH PDB: Fix misuse of IS_NEWER_THAN in timestamp check

When using a file system which only has second resolution timestamps,
there is a reasonably high likelihood of timestamps being the same.
The IS_NEWER_THAN test returns true when timestamps are the same,
so don't retry copying the PCH PDB file when they match exactly.
Craig Scott 4 rokov pred
rodič
commit
28501fca94
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  1. 3 2
      Source/cmLocalGenerator.cxx

+ 3 - 2
Source/cmLocalGenerator.cxx

@@ -2698,8 +2698,9 @@ void cmLocalGenerator::CopyPchCompilePdb(
     }
     }
 
 
     file << "foreach(retry RANGE 1 30)\n";
     file << "foreach(retry RANGE 1 30)\n";
-    file << "  if (EXISTS \"" << from_file << "\" AND \"" << from_file
-         << "  \" IS_NEWER_THAN \"" << dest_file << "\")\n";
+    file << "  if (EXISTS \"" << from_file << "\" AND (NOT EXISTS \""
+         << dest_file << "\" OR NOT \"" << dest_file << "  \" IS_NEWER_THAN \""
+         << from_file << "\"))\n";
     file << "    execute_process(COMMAND ${CMAKE_COMMAND} -E copy";
     file << "    execute_process(COMMAND ${CMAKE_COMMAND} -E copy";
     file << " \"" << from_file << "\""
     file << " \"" << from_file << "\""
          << " \"" << to_dir << "\" RESULT_VARIABLE result "
          << " \"" << to_dir << "\" RESULT_VARIABLE result "