summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2019-09-09 08:34:08 (GMT)
committerRolf Eike Beer <eb@emlix.com>2019-09-09 08:34:08 (GMT)
commit5b96fd5b81bde4655e471a31bf0fc579c1d10136 (patch)
tree13d9a3b24d84e1d15c4e1929c6c6224ae126675f /Source/cmGeneratorTarget.cxx
parent5eaf1e1be289245267263536f5464e40d2a677c0 (diff)
downloadCMake-5b96fd5b81bde4655e471a31bf0fc579c1d10136.zip
CMake-5b96fd5b81bde4655e471a31bf0fc579c1d10136.tar.gz
CMake-5b96fd5b81bde4655e471a31bf0fc579c1d10136.tar.bz2
use cmSystemTools::MoveFileIfDifferent()
This is better than doing CopyFileIfDifferent() followed by RemoveFile() in two ways: - it is more efficient, as it avoids disk I/O for the data, even if the files here are usually small - it is atomic, so an abort during the copy will not leave a destination file with partial data behind
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b4706a3..f1c48cc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3417,8 +3417,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
file << pchEpilogue << "\n";
}
}
- cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
- cmSystemTools::RemoveFile(filename_tmp);
+ cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
}
return inserted.first->second;
}
@@ -3451,8 +3450,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
cmGeneratedFileStream file(filename_tmp);
file << "/* generated by CMake */\n";
}
- cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
- cmSystemTools::RemoveFile(filename_tmp);
+ cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
}
return inserted.first->second;
}