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.
This commit is contained in:
Craig Scott
2021-02-21 18:37:31 +11:00
committed by Brad King
parent d7c8030541
commit 28501fca94

View File

@@ -2698,8 +2698,9 @@ void cmLocalGenerator::CopyPchCompilePdb(
}
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 << " \"" << from_file << "\""
<< " \"" << to_dir << "\" RESULT_VARIABLE result "