File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,31 @@ 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
+ string (REPLACE " " ";" ARGS_LIST ${CMAKE_Swift_FLAGS} )
12
+ execute_process (
13
+ COMMAND ${CMAKE_Swift_COMPILER} ${ARGS_LIST} -print-target -info
14
+ OUTPUT_VARIABLE output
15
+ ERROR_VARIABLE error_output
16
+ RESULT_VARIABLE result
17
+ )
18
+ if (NOT ${result} EQUAL 0)
19
+ message (FATAL_ERROR "Error getting target info with\n "
20
+ " `${CMAKE_Swift_COMPILER} ${CMAKE_Swift_FLAGS} -print-target-info`\n "
21
+ "Error:\n "
22
+ " ${error_output} " )
23
+ endif ()
24
+
25
+ string (REGEX MATCH "\" runtimeLibraryPaths\" : \\ [\n\ +\" ([^\" ]+)\" "
26
+ path ${output} )
27
+ set_target_properties (plutil PROPERTIES BUILD_RPATH ${CMAKE_MATCH_1} )
28
+ endif ()
29
+
5
30
set_target_properties (plutil PROPERTIES
6
31
INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME} >" )
7
32
You can’t perform that action at this time.
0 commit comments