I have 2 targets and 1 CLibBSM module(SPM) in MyApp project in Xcode 11.5
1.MyApp(GUI App)
2.Utility link to CLibBSM(Command Line Tool)
Individual compile are very well.
But When I copy Utility into MyApp at "Build Phases"(Wrapper-subpath:Contents/Library/LaunchServices) in MyApp that occurred "Swift compiler error - No such module `CLibBSM`" issue.
Is it possible to solve this issue?
CLibBSM/Package.swift(SPM)
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CLibBSM",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "CLibBSM",
targets: ["CLibBSM"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "CLibBSM",
dependencies: []),
.testTarget(
name: "CLibBSMTests",
dependencies: ["CLibBSM"]),
]
)
CLibBSM/Sources/CLibBSM/include/module.modulemap(SPM)
module CLibBSM [system] {
header "shim.h"
link "bsm"
export *
}
CLibBSM/Sources/CLibBSM/include/shim.h(SPM)
#ifndef __CLIBBSM_SHIM_H__
#define __CLIBBSM_SHIM_H__
#import <sys/sysctl.h>
#import <Foundation/Foundation.h>
#import <unistd.h>
#import <libproc.h>
#import <pthread.h>
#import <bsm/audit.h>
#import <sys/ioctl.h>
#import <sys/types.h>
#import <bsm/libbsm.h>
#import <bsm/audit_kevents.h>
#import <security/audit/audit_ioctl.h>
#import <sys/proc_info.h>
#endif
CLibBSM/Sources/CLibBSM/shim.c(SPM)
//empty