From 0cf0a8e632ccaf0ec242bf8837577d932b42900b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 24 Sep 2023 16:36:31 -0400 Subject: cmGeneratorTarget: use `GetSupportDirectory` in PCH codepaths Instead of recalculating the support directory path, use the intended method. --- Source/cmGeneratorTarget.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ca38be6..181ffd1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4287,9 +4287,6 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom); } - filename = cmStrCat( - generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/"); - const std::map 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")) { -- cgit v0.12