File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,30 @@ add_executable(plutil
2
2
main.swift)
3
3
target_link_libraries (plutil PRIVATE
4
4
Foundation)
5
+
6
+ # On ELF platforms, remove the absolute rpath to the host toolchain's stdlib,
7
+ # then add it back temporarily as a BUILD_RPATH just for the tests.
8
+ if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows" )
9
+ target_link_options (plutil PRIVATE "SHELL:-no-toolchain-stdlib-rpath" )
10
+
11
+ execute_process (
12
+ COMMAND ${CMAKE_Swift_COMPILER} ${CMAKE_Swift_FLAGS} -print-target -info
13
+ OUTPUT_VARIABLE output
14
+ ERROR_VARIABLE error_output
15
+ RESULT_VARIABLE result
16
+ )
17
+ if (NOT ${result} EQUAL 0)
18
+ message (FATAL_ERROR "Error getting target info with\n "
19
+ " `${CMAKE_Swift_COMPILER} ${CMAKE_Swift_FLAGS} -print-target-info`\n "
20
+ "Error:\n "
21
+ " ${error_output} " )
22
+ endif ()
23
+
24
+ string (REGEX MATCH "\" runtimeLibraryPaths\" : \\ [\n\ +\" ([^\" ]+)\" "
25
+ path ${output} )
26
+ set_target_properties (plutil PROPERTIES BUILD_RPATH ${CMAKE_MATCH_1} )
27
+ endif ()
28
+
5
29
set_target_properties (plutil PROPERTIES
6
30
INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME} >" )
7
31
You can’t perform that action at this time.
0 commit comments