mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 14:48:19 -05:00
Merge topic 'pch-no-duplicates'
e01935ac9d PCH: No repeated path for internal generated PCH files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4030
This commit is contained in:
@@ -3376,14 +3376,8 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
|
||||
this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom);
|
||||
}
|
||||
|
||||
if (this->GetGlobalGenerator()->IsMultiConfig()) {
|
||||
filename = cmStrCat(
|
||||
generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/");
|
||||
} else {
|
||||
// For GCC we need to have the header file .h[xx]
|
||||
// next to the .h[xx].gch file
|
||||
filename = generatorTarget->ObjectDirectory;
|
||||
}
|
||||
filename = cmStrCat(
|
||||
generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/");
|
||||
|
||||
const std::map<std::string, std::string> languageToExtension = {
|
||||
{ "C", ".h" },
|
||||
|
||||
@@ -3122,6 +3122,14 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
|
||||
const char* pchExtension = source.GetProperty("PCH_EXTENSION");
|
||||
if (pchExtension) {
|
||||
customOutputExtension = pchExtension;
|
||||
|
||||
// Make sure that for the CMakeFiles/<target>.dir/cmake_pch.h|xx.c|xx
|
||||
// source file, we don't end up having
|
||||
// CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/cmake_pch.h|xx.pch
|
||||
cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
|
||||
while (var.find(objectName)) {
|
||||
objectName.erase(var.start(), var.end() - var.start());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the source extension if it is to be replaced.
|
||||
|
||||
Reference in New Issue
Block a user