summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-06-28 04:28:48 (GMT)
committerSaleem Abdulrasool <compnerd@compnerd.org>2019-07-18 03:45:54 (GMT)
commit6814567e8c1c73c09e98ebcd1296e4fda717f0a4 (patch)
tree69e657e4db7ddc8ef9dc88d1eb8c17b09b9a9760 /Modules
parentc8741e8ff5ed93467812378413f1b3338c0ee6b2 (diff)
downloadCMake-6814567e8c1c73c09e98ebcd1296e4fda717f0a4.zip
CMake-6814567e8c1c73c09e98ebcd1296e4fda717f0a4.tar.gz
CMake-6814567e8c1c73c09e98ebcd1296e4fda717f0a4.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeSwiftInformation.cmake6
1 files changed, 6 insertions, 0 deletions
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 <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ else()
+ set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ endif()
+
set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
set(CMAKE_Swift_ARCHIVE_FINISH "")
endif()