diff options
author | Evan Wilde <etceterawilde@gmail.com> | 2022-10-26 23:11:51 (GMT) |
---|---|---|
committer | Evan Wilde <etceterawilde@gmail.com> | 2022-10-28 23:44:26 (GMT) |
commit | e88509d0e87eaa6f41603bfd7b07b653527e88c0 (patch) | |
tree | b7d43db0ee99bc1a1a7d79640d434725820d949c /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | bcf203226a6877824b91f2ffa9b5cc0373900273 (diff) | |
download | CMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.zip CMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.tar.gz CMake-e88509d0e87eaa6f41603bfd7b07b653527e88c0.tar.bz2 |
Swift: Omit output-file-map when used as a linker
Swift is used as the linker for non-swift files because it needs to pull
files like swiftrt.o in when swift symbols are present to ensure that
the swift runtime is linked.
The swift driver uses clang as the underlying linker, which pulls in
crtbegin.o and friends when appropriate, so using Swift as a linker for
C/C++ libraries is fine.
The output-file-map was getting passed to all Swift invocations,
regardless of whether or not we generated one. This patch changes it so
that we only include the output-file-map in the Swift compiler
invocation if we have actually generated the file.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index bda8a5f..895a4c3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -372,7 +372,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; vars.SwiftModule = "$SWIFT_MODULE"; vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; - vars.SwiftOutputFileMap = "$SWIFT_OUTPUT_FILE_MAP"; vars.SwiftSources = "$SWIFT_SOURCES"; vars.Defines = "$DEFINES"; @@ -1072,12 +1071,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( cmOutputConverter::SHELL); }(vars["SWIFT_MODULE_NAME"]); - const std::string map = cmStrCat(gt->GetSupportDirectory(), '/', config, - '/', "output-file-map.json"); - vars["SWIFT_OUTPUT_FILE_MAP"] = - this->GetLocalGenerator()->ConvertToOutputFormat( - this->ConvertToNinjaPath(map), cmOutputConverter::SHELL); - vars["SWIFT_SOURCES"] = [this, config]() -> std::string { std::vector<cmSourceFile const*> sources; std::stringstream oss; @@ -1101,6 +1094,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( vars["DEFINES"] = this->GetDefines("Swift", config); vars["FLAGS"] = this->GetFlags("Swift", config); vars["INCLUDES"] = this->GetIncludes("Swift", config); + this->GenerateSwiftOutputFileMap(config, vars["FLAGS"]); } // Compute specific libraries to link with. |