I have the following project structure:
.
├── Package.swift
├── Sources
│ └── Argon
│ ├── include
│ │ └── Argon.h
│ └── some_source.c
└── deps
└── olive.c
└── olive.c # Header file
Contents op Package.swift:
// swift-tools-version: 5.7
import PackageDescription
let package = Package(
name: "MyPackage",
targets: [
.target(
name: "Argon",
cSettings: [
.headerSearchPath("deps/olive.c"),
]
)
]
)
Argon.h contains the follwing include:
#include <olive.c>
When I run swift build
, I get the following error:
In file included from /Users/jonaseveraert/Documents/projects/photobooth/Sources/Argon/some_source.c:3:
/Users/jonaseveraert/Documents/projects/photobooth/Sources/Argon/src/../include/argon.h:41:10: fatal error: 'olive.c' file not found
#include <olive.c>
^~~~~~~~~
1 error generated.
It looks to me that the headerSearchPath
is not working.
I have tried with .unsafeFlags(["-Idep/olive.c"])
, but did not work.
I tried renaming olive.c to olive.h, did not work.
Anyone have any pointers on why this happens?
(yes, the header file ends with a .c extension, that's how the library creatorr named it)