diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-12-05 10:30:51 (GMT) |
---|---|---|
committer | Cristian Adam <cristian.adam@gmail.com> | 2019-12-08 19:22:34 (GMT) |
commit | 93becd61d19baa718bb10f2df25fedf31dfc2ded (patch) | |
tree | d1c8a24e62409734db9a484c4ac145ab0453d150 /Source/cmLocalGenerator.cxx | |
parent | a033bafbe01fcb4654f075955e0b3de7be81b0f7 (diff) | |
download | CMake-93becd61d19baa718bb10f2df25fedf31dfc2ded.zip CMake-93becd61d19baa718bb10f2df25fedf31dfc2ded.tar.gz CMake-93becd61d19baa718bb10f2df25fedf31dfc2ded.tar.bz2 |
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
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 923d2a5..341f998 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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"; } |