How do automatic C language targets work

The documentation says everything should work automatically with an include folder, it does not seem like that's true (I've always had to create module map files manually)

Am I misunderstanding the documentation? To me it says if there's headers in that include folder they should work, they do not.

.systemLibrary() targets need a module map, but they don't automatically look for headers. You have to provide a single file for those in a module map. Those targets only link existing binaries afaik.

using .target() just like with Swift will compile source. SPM can compile Swift, C, and C++ in this target form. For C and C++ the target will automatically check sources in src and public headers in include, but you can override these with the arguments sources and publicHeadersPath.

There is no possible way to include a pre-compiled binary in a SPM target during build
(except on apple platforms with XCFramework)
So if you're using a pre-compiled library the auto include directory can't be used because you need to use a .systemLibrary() target for those.

I was doing that, however I only had headers :slight_smile:
I had to create an empty C file for it to "compile" and now I can use the headers.