Skip to content

Commit 338d661

Browse files
committed
[CMake] fix runpath for ELF platforms
Remove the absolute path to the host toolchain's stdlib from libXCTest.so and add $ORIGIN.
1 parent 0bd9e76 commit 338d661

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
5656
target_link_libraries(XCTest PRIVATE
5757
dispatch
5858
Foundation)
59+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
60+
target_link_options(XCTest PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
61+
set_target_properties(XCTest PROPERTIES INSTALL_RPATH "$ORIGIN")
62+
endif()
5963
endif()
6064
set_target_properties(XCTest PROPERTIES
6165
Swift_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swift

0 commit comments

Comments
 (0)