Reputation: 303
I have created a non-syslib C module (let's call it CModule) and packaged it with Swift Package Manager such that my code is in $(package_directory)/Sources/CModule
and my Package.swift
in the aforementioned parent directory contains:
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "CModule",
products: [
.library(
name: "CModule",
type: .dynamic,
targets: ["CModule"]),
],
targets: [
.target(
name: "CModule",
dependencies: [],
path: "Sources",
cSettings: [
.headerSearchPath("CModule")])
]
)
The package compiles without errors, but after adding it to another Swift project with File -> Swift Packages -> Add Package Dependency
and inputting the local repo (file:///Users...etc
), which does give me the right target, doing import CModule
within this new project gives me the Module not found error.
I have already relaunched Xcode, did Clean Build Folder followed by a normal Build, and tried another approach such as it was described in How to make custom C code into a SwiftPM package?
Upvotes: 6
Views: 7216
Reputation: 1046
Try these steps:
1. File -> Swift Packages -> Reset Package Caches
After packages are reset, follow below steps:
2. File -> Swift Packages -> Update to Latest Package Versions
Upvotes: 3