diff options
author | Craig Hutchinson <54269136+CraigHutchinson@users.noreply.github.com> | 2023-01-13 13:34:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-17 14:20:39 (GMT) |
commit | 9a013c9e9d344f9703f339c6aeab9dcc303b53c0 (patch) | |
tree | 154b926732b7d29f63f42bc745ef20d19a47642c /Modules | |
parent | 485a72dc64602a0e1513744bd3855333e1dfb1da (diff) | |
download | CMake-9a013c9e9d344f9703f339c6aeab9dcc303b53c0.zip CMake-9a013c9e9d344f9703f339c6aeab9dcc303b53c0.tar.gz CMake-9a013c9e9d344f9703f339c6aeab9dcc303b53c0.tar.bz2 |
Swift: Use macOS-style linker flags on iOS, tvOS, and watchOS too
Without this, building a shared Swift library with `CMAKE_SYSTEM_NAME=iOS`
produces the error `ld: unknown option: -soname`. iOS is an Apple platform,
and so should use the `-install_name` option.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeSwiftInformation.cmake | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 62f7ef2..707635b 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -20,7 +20,8 @@ endif() set(CMAKE_EXE_EXPORTS_Swift_FLAG "-emit-module -emit-module-path <SWIFT_MODULE> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS}") set(CMAKE_INCLUDE_FLAG_Swift "-I ") -if(CMAKE_SYSTEM_NAME STREQUAL Darwin) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ") elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ") @@ -29,7 +30,8 @@ endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") - if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "") else() |