Umbrella header ... directories exist next to it?

target 'SDK' has invalid header layout: umbrella header found at '.../Sources/SDK/include/SDK.h', but directories exist next to it: .../Sources/SDK/include/cpp, /.../Sources/SDK/include/hx; consider removing them

But these directories contain the headers that my umbrella header is including. Am I required to flatten the hierarchy in order to use an umbrella header for a C++ target with SPM?

The rules for autogenerated module maps are pretty restrictive: swift-package-manager/Documentation/ at main · apple/swift-package-manager · GitHub

I would recommend creating a custom module map if you have a different existing layout.

Really? Isn't a module map just a more complex way of doing the same thing as an umbrella header? That's how the docs made it seem...

Not quite, a module map is always needed, but SwiftPM will automatically generate one if you have a somewhat simple header layout with an umbrella header. If the header layout doesn't match SwiftPM's expectations, it'll give you a diagnostic like the one you got since it wasn't able to figure out how to generate the module map automatically.

1 Like