From 71e677392bb15b1ed87e98b75d19122cdc249c77 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Sep 2019 12:02:47 -0400 Subject: Do not collect objects from dependencies of object libraries Object libraries do not link and therefore do not need to consider the object files from "linked" dependencies on other object libraries. This was an oversight in commit 57538224d0 (objlib: Link object-files from `OBJECT` libraries, 2017-12-14, v3.12.0-rc1~419^2~2). Fixes: #19744 Inspired-by: Julien Finet --- Source/cmGeneratorTarget.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 18ca478..8e3db2b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1454,11 +1454,14 @@ std::vector> cmGeneratorTarget::GetSourceFilePaths( this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources); // Collect TARGET_OBJECTS of direct object link-dependencies. - std::vector linkObjectsEntries; - AddObjectEntries(this, config, &dagChecker, linkObjectsEntries); + bool contextDependentObjects = false; std::vector::size_type numFilesBefore2 = files.size(); - bool contextDependentObjects = - processSources(this, linkObjectsEntries, files, uniqueSrcs, debugSources); + if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) { + std::vector linkObjectsEntries; + AddObjectEntries(this, config, &dagChecker, linkObjectsEntries); + contextDependentObjects = processSources(this, linkObjectsEntries, files, + uniqueSrcs, debugSources); + } if (!contextDependentDirectSources && !(contextDependentInterfaceSources && numFilesBefore < files.size()) && -- cgit v0.12