cmGeneratorTarget: use GetSupportDirectory in PCH codepaths

Instead of recalculating the support directory path, use the intended
method.
This commit is contained in:
Ben Boeckel
2023-09-24 16:36:31 -04:00
parent 8847fceac6
commit 0cf0a8e632

View File

@@ -4287,9 +4287,6 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
filename = cmStrCat(
generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/");
const std::map<std::string, std::string> languageToExtension = {
{ "C", ".h" },
{ "CXX", ".hxx" },
@@ -4297,8 +4294,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
{ "OBJCXX", ".objcxx.hxx" }
};
filename =
cmStrCat(filename, "CMakeFiles/", generatorTarget->GetName(), ".dir");
filename = generatorTarget->GetSupportDirectory();
if (this->GetGlobalGenerator()->IsMultiConfig()) {
filename = cmStrCat(filename, "/", config);
@@ -4391,9 +4387,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
filename =
cmStrCat(generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(),
"/CMakeFiles/", generatorTarget->GetName(), ".dir/cmake_pch");
filename = cmStrCat(generatorTarget->GetSupportDirectory(), "/cmake_pch");
// For GCC the source extension will be transformed into .h[xx].gch
if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) {