mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
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.
This commit is contained in:
committed by
Brad King
parent
485a72dc64
commit
9a013c9e9d
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user