فهرست منبع

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
Brad King 5 سال پیش
والد
کامیت
14a5712447
2فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 3 0
      Source/cmGeneratorTarget.cxx
  2. 1 0
      Tests/SwiftOnly/CMakeLists.txt

+ 3 - 0
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 };

+ 1 - 0
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)