Skip to content

Commit 15cd1b2

Browse files
committed
Add rpath to test runner binaries to find adjacent test dylib
1 parent 8b1cfc9 commit 15cd1b2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Products.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,13 @@ extension PackagePIFProjectBuilder {
10221022
// This should eventually be set universally for all package targets/products.
10231023
settings[.LINKER_DRIVER] = "swiftc"
10241024

1025+
// A test-runner should always be adjacent to the dynamic library containing the tests,
1026+
// so add the appropriate rpaths.
1027+
settings[.LD_RUNPATH_SEARCH_PATHS] = [
1028+
"$(inherited)",
1029+
"$(RPATH_ORIGIN)"
1030+
]
1031+
10251032
let deploymentTargets = unitTestProduct.deploymentTargets
10261033
settings[.MACOSX_DEPLOYMENT_TARGET] = deploymentTargets?[.macOS] ?? nil
10271034
settings[.IPHONEOS_DEPLOYMENT_TARGET] = deploymentTargets?[.iOS] ?? nil

0 commit comments

Comments
 (0)