Root cause of "Umbrella header for module ... does not include"?

I couldn't find any prior threads that matched my situation and I know this is more of a Clang question but my issue is while trying to integrate with a Swift project so I'm giving it a shot.

I am getting "Umbrella header for module ... does not include ..." warnings for C header files that are intentionally not in the umbrella header and which I don't care to expose to my Cocoa Touch Framework. The headers in the warnings are ones that are only needed during the compilation of the static library I'm linking in. I would like to "do the right thing" and satisfy the compiler without just turning off warnings.

I have a 3rd party C library with its own makefile that builds a single static lib. It has an /include folder with an umbrella header. The include folder contains other header files included by the umbrella and some that are not included in the umbrella. I created a module map file and placed it at the top of /include that looks like:

module SomeModule {
	umbrella header "somemodule.h"
	export *
}

Then from my Cocoa Touch Framework build settings I added to SWIFT_INCLUDE_PATHS the path to this /include folder.

The include folder structure looks something like:
/include/somemodule.h (The umbrella header)
/include/folderA/header1.h
/include/folderA/header2.h
/include/folderB/header1.h
....

As best I can tell, the "Umbrella header ... does not include header" warning is because the /include folder contains headers not imported by the umbrella header. Is this determined to be "wrong" even if another module never references the headers that exist, but aren't in the umbrella header? If I wanted to stop the warnings, what do I need to do? Move the non-umbrella-imported headers into a different path?

You can mark these headers as exclude header "blah.h". The warnings are there to make sure you didn't miss something, but it's not required to include all headers. If it's a library you're distributing, though, I'd suggest that a better answer would be to not copy those headers into the build product at all.

2 Likes

Thank you @jrose! In this case I don't own the library so I want to have a very light touch and these exclude cases did just what I needed. Much appreciated.