Currently in Swift 3 release of SwiftPM, you cannot override this setting.
A proper solution to this problem is yet to be built in SwiftPM however in
the mean time this patch was landed to allow overrides by passing custom
It is available in a recent trunk snapshot from swift.org
Also, while passing custom arguments to swift build, escape each argument
with the prefix eg:
*`-Xswiftc -target x86_64-apple-macosx10.12` **should be:** `**-Xswiftc
-target **-Xswiftc **x86_64-apple-macosx10.12`*
On Mon, Oct 17, 2016 at 5:23 AM, Edward Connell via swift-users <
> Hi, I've written a Swift (with some C) framework the builds and runs
> cleanly in Xcode 8.
> A critical feature of my project is for my framework to run on MacOS, iOS,
> and Linux.
> I am trying to figure out how to build using the SPM so I can run on
> I'm not so happy with the project structure now, but at least I think I am
> almost there.
> I've hit a sticking point that I can't seem to figure out. The SPM sets
> the target SDK to 10.10 by default.
> Features in Swift 3.0 that I am using require at least 10.11. When I type:
> *swift build -Xcc -I/usr/local/include -Xswiftc -j4 -Xlinker
> -L/usr/local/lib -Xlinker -lpng -Xlinker -ljpeg*
> The build bombs with:
> "... error: 'init(fileURLWithPath:relativeTo:)' is only available on OS X
> 10.11 or newer"
> How do I set the correct OS version??
> I looked at the Xcode settings and tried to pass them through, but there
> seems to be an argument parsing error by SPM.
> I am currently trying:
> *swift build -Xcc -I/usr/local/include -Xswiftc -j4 -Xswiftc -sdk
> -Xswiftc -target x86_64-apple-macosx10.12 -Xlinker -L/usr/local/lib
> -Xlinker -lpng -Xlinker -ljpeg*
> And I get:
> error: unknown command: /Applications/Xcode.app/
> So it seems it thinks the parameter is a command.
> *How do you set the sdk and target versions through swift build to fix
> this problem?*
> Thanks, Ed
> MacBook Pro (Retina, 13-inch, Early 2015)
> Sierra 10.12 (16A323)
> Xcode Version 8.0 (8A218a)
> swift-users mailing list
swift-users mailing list