mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
PCH: Clear link interface cache when adding PCH object to it
On platforms using `CMAKE_LINK_PCH`, the implementation of `PRECOMPILE_HEADERS_REUSE_FROM`, when re-using the PCH from one object library in another, adds a PCH object file to the link interface. Clear any cached link interface to ensure it is used.
This commit is contained in:
@@ -749,6 +749,12 @@ void cmGeneratorTarget::ClearSourcesCache()
|
|||||||
this->LinkImplMap.clear();
|
this->LinkImplMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmGeneratorTarget::ClearLinkInterfaceCache()
|
||||||
|
{
|
||||||
|
this->LinkInterfaceMap.clear();
|
||||||
|
this->LinkInterfaceUsageRequirementsOnlyMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before)
|
void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before)
|
||||||
{
|
{
|
||||||
this->SourceEntries.insert(
|
this->SourceEntries.insert(
|
||||||
|
|||||||
@@ -664,6 +664,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
void ClearSourcesCache();
|
void ClearSourcesCache();
|
||||||
|
|
||||||
|
// Do not use. This is only for a specific call site with a FIXME comment.
|
||||||
|
void ClearLinkInterfaceCache();
|
||||||
|
|
||||||
void AddSource(const std::string& src, bool before = false);
|
void AddSource(const std::string& src, bool before = false);
|
||||||
void AddTracedSources(std::vector<std::string> const& srcs);
|
void AddTracedSources(std::vector<std::string> const& srcs);
|
||||||
|
|
||||||
|
|||||||
@@ -2615,10 +2615,15 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
|||||||
true);
|
true);
|
||||||
} else if (reuseTarget->GetType() ==
|
} else if (reuseTarget->GetType() ==
|
||||||
cmStateEnums::OBJECT_LIBRARY) {
|
cmStateEnums::OBJECT_LIBRARY) {
|
||||||
|
// FIXME: This can propagate more than one level, unlike
|
||||||
|
// the rest of the object files in an object library.
|
||||||
|
// Find another way to do this.
|
||||||
target->Target->AppendProperty(
|
target->Target->AppendProperty(
|
||||||
"INTERFACE_LINK_LIBRARIES",
|
"INTERFACE_LINK_LIBRARIES",
|
||||||
cmStrCat("$<$<CONFIG:", config,
|
cmStrCat("$<$<CONFIG:", config,
|
||||||
">:$<LINK_ONLY:", pchSourceObj, ">>"));
|
">:$<LINK_ONLY:", pchSourceObj, ">>"));
|
||||||
|
// We updated the link interface, so ensure it is recomputed.
|
||||||
|
target->ClearLinkInterfaceCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user