浏览代码

Swift: fix static library handling

Handle static libraries similar to shared libraries.  Do not pass along
the shared library flags raw as that will pass flags for the linker to
the driver which is incorrect.
Saleem Abdulrasool 6 年之前
父节点
当前提交
59f2aa63e4
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      Source/cmLocalGenerator.cxx

+ 7 - 5
Source/cmLocalGenerator.cxx

@@ -1134,11 +1134,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
                                              std::string const& linkLanguage,
                                              std::string const& linkLanguage,
                                              cmGeneratorTarget* target)
                                              cmGeneratorTarget* target)
 {
 {
-  this->AppendFlags(
-    flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
-  if (!config.empty()) {
-    std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
-    this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
+  if (linkLanguage != "Swift") {
+    this->AppendFlags(
+      flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
+    if (!config.empty()) {
+      std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
+      this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
+    }
   }
   }
   this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
   this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
   if (!config.empty()) {
   if (!config.empty()) {