mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
PCH: Use the target's PREFIX for building the pdb file name
Also copy the REUSE_FROM pdb file only if the file is newer than the existing one. Fixes: #19731 Fixes: #20068
This commit is contained in:
@@ -2381,9 +2381,25 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
|
||||
target->GetName(), ".dir/${PDB_PREFIX}");
|
||||
|
||||
file << "if (EXISTS \"" << from_file << "\")\n";
|
||||
const std::string to_file =
|
||||
cmStrCat(to_dir, pchReuseFrom, extension);
|
||||
|
||||
std::string dest_file = to_file;
|
||||
|
||||
const std::string prefix = target->GetSafeProperty("PREFIX");
|
||||
if (!prefix.empty()) {
|
||||
dest_file = cmStrCat(to_dir, prefix, pchReuseFrom, extension);
|
||||
}
|
||||
|
||||
file << "if (EXISTS \"" << from_file << "\" AND \"" << from_file
|
||||
<< "\" IS_NEWER_THAN \"" << dest_file << "\")\n";
|
||||
file << " file(COPY \"" << from_file << "\""
|
||||
<< " DESTINATION \"" << to_dir << "\")\n";
|
||||
if (!prefix.empty()) {
|
||||
file << " file(REMOVE \"" << dest_file << "\")\n";
|
||||
file << " file(RENAME \"" << to_file << "\" \"" << dest_file
|
||||
<< "\")\n";
|
||||
}
|
||||
file << "endif()\n";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user