I am trying to create a Swift package that uses CommonCrypto as a system library target (cf. systemlibrary(name:path:pkgconfig:providers:)), but I cannot get it to work by just passing the name:
// swift-tools-version: 5.8
import PackageDescription
let package = Package(
name: "MyPackage",
defaultLocalization: "en",
platforms: [
.iOS(.v14)
],
products: [
.library(
name: "MyPackage",
targets: ["MyPackage"]),
],
targets: [
.target(
name: "MyPackage",
dependencies: ["CommonCrypto"]
)
.systemLibrary(
name: "CommonCrypto"
)
],
swiftLanguageVersions: [.v5]
)
I have a module map looking like this
module CommonCrypto [system] {
umbrella header "CommonCrypto.h"
export *
module * { export * }
}
and the following umbrella header
#pragma once
#include <CommonCrypto/CommonCrypto.h>
in Sources/CommonCrypto
. However, I still cannot swift build
the package:
error: cannot find 'kCCSuccess' in scope
What am I missing?