瀏覽代碼

Merge topic 'swift-with-interface-libs'

601fe84bd1 Swift: Restore support for enabling with INTERFACE libraries

Acked-by: Kitware Robot <[email protected]>
Acked-by: Wanderley Guimarães da Silva <[email protected]>
Acked-by: Guillaume Egles <[email protected]>
Merge-request: !3624
Brad King 6 年之前
父節點
當前提交
e4193adf29
共有 2 個文件被更改,包括 12 次插入8 次删除
  1. 9 8
      Source/cmGlobalGenerator.cxx
  2. 3 0
      Tests/SwiftOnly/CMakeLists.txt

+ 9 - 8
Source/cmGlobalGenerator.cxx

@@ -337,15 +337,16 @@ bool cmGlobalGenerator::CheckTargetsForType() const
   bool failed = false;
   for (cmLocalGenerator* generator : this->LocalGenerators) {
     for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) {
-      std::vector<std::string> configs;
-      target->Makefile->GetConfigurations(configs);
-      if (configs.empty()) {
-        configs.emplace_back();
-      }
+      if (target->GetType() == cmStateEnums::EXECUTABLE &&
+          target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
+        std::vector<std::string> configs;
+        target->Makefile->GetConfigurations(configs);
+        if (configs.empty()) {
+          configs.emplace_back();
+        }
 
-      for (std::string const& config : configs) {
-        if (target->GetLinkerLanguage(config) == "Swift") {
-          if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
+        for (std::string const& config : configs) {
+          if (target->GetLinkerLanguage(config) == "Swift") {
             this->GetCMakeInstance()->IssueMessage(
               MessageType::FATAL_ERROR,
               "WIN32_EXECUTABLE property is not supported on Swift "

+ 3 - 0
Tests/SwiftOnly/CMakeLists.txt

@@ -8,3 +8,6 @@ elseif(NOT XCODE_VERSION VERSION_LESS 8.0)
 endif()
 
 add_executable(SwiftOnly main.swift)
+
+# Dummy to make sure generation works with such targets.
+add_library(SwiftIface INTERFACE)