mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
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
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user