Linking against a different macOS SDK or Toolchain?

Hello,

TL;DR
How to tell swift to link to libraries in /Library/Developer/CommandLineTools/SDKs or /Library/Developer/Toolchains instead of /usr/lib/swift ?

Context
Thanks to your help, I made progress on this issue.

I managed to compile on macOS 12 a Swift 5.7 code using Regex by installing Xcode 14.1 beta and its command line tools. This installs the MacOS13 SDK in /Library/Developer/CommandLineTools/SDKs

Compilation works, but not execution.

Building for debugging...
[4/4] Linking mm
Build complete! (9.17s)
dyld[34064]: Library not loaded: '/usr/lib/swift/libswift_StringProcessing.dylib'
  Referenced from: '/Users/stormacq/Documents/amazon/code/amplify/amplify-ios-workshop/migrate_markdown/.build/arm64-apple-macosx/debug/mm'
  Reason: tried: '/usr/lib/swift/libswift_StringProcessing.dylib' (no such file), '/usr/local/lib/libswift_StringProcessing.dylib' (no such file), '/usr/lib/libswift_StringProcessing.dylib' (no such file)
[1]    34064 abort      $TOOLCHAIN_DIR/usr/bin/swift run -Xswiftc -enable-bare-slash-regex

At runtime, it complains about missing libswift_StringProcessor.dylib and libswift_Regex.dylib.
otool shows the binary is linked to /usr/lib/swiftt/*dylib

otool -L .build/arm64-apple-macosx/debug/mm
.build/arm64-apple-macosx/debug/mm:
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.1.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.1.0)
        /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 0.0.0)
        /usr/lib/swift/libswiftCoreFoundation.dylib (compatibility version 1.0.0, current version 120.100.0, weak)
        /usr/lib/swift/libswiftDarwin.dylib (compatibility version 1.0.0, current version 0.0.0, weak)
        /usr/lib/swift/libswiftDispatch.dylib (compatibility version 1.0.0, current version 17.0.0, weak)
        /usr/lib/swift/libswiftIOKit.dylib (compatibility version 1.0.0, current version 1.0.0, weak)
        /usr/lib/swift/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 6.0.0, weak)
        /usr/lib/swift/libswiftSwiftOnoneSupport.dylib (compatibility version 1.0.0, current version 0.0.0)
        /usr/lib/swift/libswiftXPC.dylib (compatibility version 1.0.0, current version 6.0.0, weak)
        /usr/lib/swift/libswift_StringProcessing.dylib (compatibility version 1.0.0, current version 0.0.0)

I copied the two dylib above to /usr/local/lib and now it complaints about missing symbols in Foundation.frameworks

sudo cp /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-10-09-a.xctoolchain/usr/lib/swift/macosx/libswift_StringProcessing.dylib /usr/local/lib

sudo cp /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-10-09-a.xctoolchain/usr/lib/swift/macosx/libswift_RegexParser.dylib /usr/local/lib 

$TOOLCHAIN_DIR/usr/bin/swift run --sdk /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/  -Xswiftc -enable-bare-slash-regex

Building for debugging...
Build complete! (0.22s)
dyld[36167]: Symbol not found: (_$s10Foundation17URLResourceValuesV13isRegularFileSbSgvg)
  Referenced from: '/Users/stormacq/Documents/amazon/code/amplify/amplify-ios-workshop/migrate_markdown/.build/arm64-apple-macosx/debug/mm'
  Expected in: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'
[1]    36167 abort      $TOOLCHAIN_DIR/usr/bin/swift run --sdk  -Xswiftc -enable-bare-slash-regex

How can I tell the compiler / linker to use the libraries provided by a SDK or toolchain located under /Library/Developer instead of /usr/lib/swift ?