From a9d467515cddecf3f6922fbde44f496e46f2f2e8 Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Fri, 8 Nov 2024 16:45:42 -0800 Subject: [PATCH] Merge pull request #792 from bnbarham/fix-rpaths Update install to ensure the build directory is not added to the rpath --- cmake/modules/SwiftModuleInstallation.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/modules/SwiftModuleInstallation.cmake b/cmake/modules/SwiftModuleInstallation.cmake index 65c9f3c14..26ef07d4b 100644 --- a/cmake/modules/SwiftModuleInstallation.cmake +++ b/cmake/modules/SwiftModuleInstallation.cmake @@ -32,12 +32,14 @@ function(_swift_testing_install_target module) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(lib_destination_dir "lib/${swift}/${swift_os}/testing") - set_property(TARGET ${module} PROPERTY - INSTALL_RPATH "@loader_path/..") + set_target_properties(${module} PROPERTIES + INSTALL_RPATH "@loader_path/.." + INSTALL_REMOVE_ENVIRONMENT_RPATH ON) else() set(lib_destination_dir "lib/${swift}/${swift_os}") - set_property(TARGET ${module} PROPERTY - INSTALL_RPATH "$ORIGIN") + set_target_properties(${module} PROPERTIES + INSTALL_RPATH "$ORIGIN" + INSTALL_REMOVE_ENVIRONMENT_RPATH ON) endif() install(TARGETS ${module}