From 8aa0b63bc68ebd5d7eb3f7a02f9520dac54bf813 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 27 Jun 2019 21:28:48 -0700 Subject: Swift: add rules for static linking The Swift driver recently learnt how to generate static libraries using the `-static` flag. This enables us to generate proper static libraries with dependency tracking with Swift as well. --- Modules/CMakeSwiftInformation.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 6f99c1f..f62f61b 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -70,6 +70,12 @@ if(NOT CMAKE_Swift_LINK_EXECUTABLE) endif() if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY) + if(CMAKE_Swift_COMPILER_TARGET) + set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -target -output-file-map -incremental -emit-library -static -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") + else() + set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map -incremental -emit-library -static -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") + endif() + set(CMAKE_Swift_ARCHIVE_CREATE " crs ") set(CMAKE_Swift_ARCHIVE_FINISH "") endif() -- cgit v0.12