Browse Source

Swift: support `-rpath` for executables

This adjusts the flags to enable setting the RPATH for executables.
Saleem Abdulrasool 6 years ago
parent
commit
321df5783d
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Modules/CMakeSwiftInformation.cmake

+ 5 - 0
Modules/CMakeSwiftInformation.cmake

@@ -29,6 +29,11 @@ endif()
 if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
   set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
   set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
+
+  if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+    set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
+    set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP ":")
+  endif()
 endif()
 
 set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ")