Jelajahi Sumber

Merge topic 'swift-exe-module-name' into release-3.29

f292e28b84 Swift: Ninja: Pass module name to all swift builds

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !9282
Brad King 1 tahun lalu
induk
melakukan
083afc88db

+ 2 - 4
Source/cmNinjaTargetGenerator.cxx

@@ -2024,11 +2024,9 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
     this->LocalGenerator->AppendFlags(
       vars["FLAGS"], { emitModuleFlag, modulePathFlag, moduleFilepath });
     objBuild.Outputs.push_back(moduleFilepath);
-
-    std::string const moduleNameFlag = "-module-name";
-    this->LocalGenerator->AppendFlags(
-      vars["FLAGS"], cmStrCat(moduleNameFlag, ' ', moduleName));
   }
+  this->LocalGenerator->AppendFlags(vars["FLAGS"],
+                                    cmStrCat("-module-name ", moduleName));
 
   if (target.GetType() != cmStateEnums::EXECUTABLE) {
     std::string const libraryLinkNameFlag = "-module-link-name";

+ 3 - 1
Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt

@@ -1,3 +1,5 @@
 .*swiftc(.exe)? .* -parse-as-library -static -emit-module .* -module-name StaticLibrary [^
 ]*
-.*swiftc(.exe)? .* -parse-as-library -emit-module .* -module-name DynamicLibrary
+.*swiftc(.exe)? .* -parse-as-library -emit-module .* -module-name DynamicLibrary [^
+]*
+.*swiftc(.exe)? .* -j [0-9]* -num-threads [0-9]* -c  -module-name Executable

+ 4 - 0
Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake

@@ -6,3 +6,7 @@ enable_language(Swift)
 
 add_library(StaticLibrary STATIC L.swift)
 add_library(DynamicLibrary SHARED L.swift)
+add_executable(Executable E.swift)
+
+add_dependencies(DynamicLibrary StaticLibrary)
+add_dependencies(Executable DynamicLibrary)