From 9e5457d3b4f5c46028c29d731f4057e3fa76415a Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 23 May 2019 14:05:37 -0700 Subject: Ninja,Swift: correct response file handling The response file was being written but not used due to the wrong variable being configured for Swift. Swift does compile+link in a single phase and does not use the `` placeholder. Use the `` placeholder instead for the response file substitution which serves the same purpose. --- Modules/CMakeSwiftInformation.cmake | 2 ++ Source/cmNinjaNormalTargetGenerator.cxx | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 2bba178..1477e8a 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -18,10 +18,12 @@ if(CMAKE_Swift_COMPILER_ID) endif() set(CMAKE_INCLUDE_FLAG_Swift "-I ") + set(CMAKE_Swift_DEFINE_FLAG -D) set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ") set(CMAKE_Swift_COMPILER_ARG1 -frontend) set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ") +set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @) # NOTE(compnerd) use the short form for convenience and ease of search. They # are treated equivalent to their long form names as well as custom Swift diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1e4d2ed..77af45e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -321,7 +321,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) rspcontent = "$in_newline"; } rspcontent += " $LINK_PATH $LINK_LIBRARIES"; - vars.Objects = responseFlag.c_str(); + if (this->TargetLinkLanguage == "Swift") { + vars.SwiftSources = responseFlag.c_str(); + } else { + vars.Objects = responseFlag.c_str(); + } vars.LinkLibraries = ""; } -- cgit v0.12