Skip to content

Commit 53b5ff1

Browse files
finagolfindrexin
authored andcommitted
[CMake] fix runpath for ELF platforms
Remove the absolute path to the host toolchain's stdlib from the three Foundation shared libraries.
1 parent a1601ff commit 53b5ff1

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Sources/Foundation/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
157157
add_dependencies(Foundation CoreFoundationResources)
158158
target_link_options(Foundation PRIVATE
159159
$<TARGET_OBJECTS:CoreFoundationResources>)
160+
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
161+
target_link_options(Foundation PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
160162
endif()
161163

162164

Sources/FoundationNetworking/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ set_target_properties(FoundationNetworking PROPERTIES
6868
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
6969
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
7070

71+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
72+
target_link_options(FoundationNetworking PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
73+
endif()
74+
7175

7276
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationNetworking)
7377
_install_target(FoundationNetworking)

Sources/FoundationXML/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ set_target_properties(FoundationXML PROPERTIES
2020
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
2121
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
2222

23+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
24+
target_link_options(FoundationXML PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
25+
endif()
26+
2327

2428
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationXML)
2529
_install_target(FoundationXML)

0 commit comments

Comments
 (0)