Created
May 7, 2023 07:48
-
-
Save Kyle-Ye/9e960dad379e0ded065be366b4233a6c to your computer and use it in GitHub Desktop.
Add system framework search path on Package.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version: 5.8 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import Foundation | |
import PackageDescription | |
let isXcodeEnv = ProcessInfo.processInfo.environment["__CFBundleIdentifier"] == "com.apple.dt.Xcode" | |
// Xcode use clang as linker which supports "-iframework" while SwiftPM use swiftc as linker which supports "-Fsystem" | |
let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem" | |
let package = Package( | |
... | |
targets: [ | |
.target( | |
name: "Sharing", | |
linkerSettings: [ | |
.unsafeFlags([systemFrameworkSearchFlag, "/System/Library/PrivateFrameworks/"]), | |
] | |
), | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
swiftlang/swift-package-manager#6512