From 14a571244758ac6851c3a36e69f92388458c2ea0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Jul 2020 08:24:57 -0400 Subject: Swift: Fix regression in linking to interface libraries Since commit 2026915f8f (Swift: Propagate Swift_MODULE_DIRECTORY as include directory, 2020-02-03, v3.18.0-rc1~547^2) we internally call `GetAllConfigCompileLanguages` on all directly linked targets without checking if they are interface libraries that don't compile at all. That violates an internal assumption and assertion. Fixes: #20977 --- Source/cmGeneratorTarget.cxx | 3 +++ Tests/SwiftOnly/CMakeLists.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f2011ee..c7baf2b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1309,6 +1309,9 @@ void AddSwiftImplicitIncludeDirectories( for (const cmLinkImplItem& library : libraries->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { + if (dependency->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } if (cm::contains(dependency->GetAllConfigCompileLanguages(), "Swift")) { EvaluatedTargetPropertyEntry entry{ library, library.Backtrace }; diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index e24279b..41d14ea 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -35,3 +35,4 @@ target_link_libraries(N PUBLIC # Dummy to make sure generation works with such targets. add_library(SwiftIface INTERFACE) +target_link_libraries(SwiftOnly PRIVATE SwiftIface) -- cgit v0.12