diff options
author | Brad King <brad.king@kitware.com> | 2024-02-22 13:26:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-02-22 13:26:11 (GMT) |
commit | 312d0ccb6b97813e170ad8a82ce100cc35f11532 (patch) | |
tree | aeb856d5a3a999391d0436ae2e6308b95afabe0c /Source | |
parent | a4122c89c468540e8bcca284b94ba059a0955808 (diff) | |
parent | 5b8e9e068fc634459cfaeed90e20072ebaa01710 (diff) | |
download | CMake-312d0ccb6b97813e170ad8a82ce100cc35f11532.zip CMake-312d0ccb6b97813e170ad8a82ce100cc35f11532.tar.gz CMake-312d0ccb6b97813e170ad8a82ce100cc35f11532.tar.bz2 |
Merge topic 'restore-link-interface-objlib-with-unity' into release-3.29
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
1313c78a9c Tests: Update RunCMake.TargetObjects cmake_minimum_required version
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9279
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.h | 5 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index fb56a0d..fd4b2ec 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -727,7 +727,10 @@ public: */ void ClearSourcesCache(); - // Do not use. This is only for a specific call site with a FIXME comment. + /** + * Clears cached evaluations of INTERFACE_LINK_LIBRARIES. + * They will be recomputed on demand. + */ void ClearLinkInterfaceCache(); void AddSource(const std::string& src, bool before = false); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 71ab2a6..185bff9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1922,9 +1922,13 @@ bool cmGlobalGenerator::AddAutomaticSources() // Clear the source list and classification cache (KindedSources) of all // targets so that it will be recomputed correctly by the generators later // now that the above transformations are done for all targets. + // Also clear the link interface cache to support $<TARGET_OBJECTS:objlib> + // in INTERFACE_LINK_LIBRARIES because the list of object files may have + // been changed by conversion to a unity build or addition of a PCH source. for (const auto& lg : this->LocalGenerators) { for (const auto& gt : lg->GetGeneratorTargets()) { gt->ClearSourcesCache(); + gt->ClearLinkInterfaceCache(); } } return true; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0e539fe..4afed43 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2864,15 +2864,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) cm::nullopt, true); } else if (reuseTarget->GetType() == 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( "INTERFACE_LINK_LIBRARIES", cmStrCat("$<$<CONFIG:", config, ">:$<LINK_ONLY:", pchSourceObj, ">>")); - // We updated the link interface, so ensure it is recomputed. - target->ClearLinkInterfaceCache(); } } } else { |