mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
cmLocalGenerator: Simplify unity source copy-if-different logic
This commit is contained in:
@@ -2813,20 +2813,15 @@ std::string cmLocalGenerator::WriteUnitySource(
|
||||
cmValue beforeInclude, cmValue afterInclude, std::string filename) const
|
||||
{
|
||||
cmValue uniqueIdName = target->GetProperty("UNITY_BUILD_UNIQUE_ID");
|
||||
const std::string filename_tmp = cmStrCat(filename, ".tmp");
|
||||
{
|
||||
cmGeneratedFileStream file(
|
||||
filename_tmp, false,
|
||||
target->GetGlobalGenerator()->GetMakefileEncoding());
|
||||
file << "/* generated by CMake */\n\n";
|
||||
|
||||
for (cmSourceFile* sf : sources) {
|
||||
RegisterUnitySources(target, sf, filename);
|
||||
IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
|
||||
afterInclude, uniqueIdName);
|
||||
}
|
||||
cmGeneratedFileStream file(
|
||||
filename, false, target->GetGlobalGenerator()->GetMakefileEncoding());
|
||||
file.SetCopyIfDifferent(true);
|
||||
file << "/* generated by CMake */\n\n";
|
||||
for (cmSourceFile* sf : sources) {
|
||||
RegisterUnitySources(target, sf, filename);
|
||||
IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
|
||||
afterInclude, uniqueIdName);
|
||||
}
|
||||
cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user