SwiftPM doesn't seem to respect header search paths when building as a dependency

I added an issue here but essentially when building my C++ target (where changing the folder structure is not an option) I had to add the header search paths as cxxSettings. It successfully compiles the package.

I added this package as a dependency to another C++ package. When building the second package it fails to find the dependency's headers. The header search paths indeed aren't present in the build command invocation. This fails both in Xcode and using swift build.

Is there something I'm not understanding or is it really a bug? In either cases, is there something I can do to fix my build issue?

.headerSearchPath() sets the include directories used when building your target, while publicHeadersPath: is what is exported to things depending on your target. SPM does not support multiple paths in publicHeadersPath, so if you have multiple directories which are include roots then you have to get creative. One option is to have a separate target for each set of headers that you want to export.

As a requirement I can't modify the folder structure of the project and it looks like that:

Package
  Assets
  Classes
    Subfolder
      MoreRecursiveSubfolders
        Header.h
      Header.h
    Subfolder
      Header.h
    Header.h
  Header.h

As far as I'm aware targets can't overlap so multiple modules isn't an option. I tried using an include directory with linked headers but it would cause duplicate definitions because the headers in the source would still exist.

I also tried modulemaps but using an umbrella directory, could I maybe specify multiple public headers via the modulemap?

module MyModule {
    umbrella "Classes"
    export *
    requires cplusplus14
}

I've now tried with the following module map which builds successfully.

module MyModule {
    umbrella "Classes"
    export *
    module * { export * }
}

But when I include this package as a dependency for another package (built using a similar modulemap) it cannot find any headers. Not through <MyModule/Header.h> or "Header.h" (I'd need this one).

It seems to be completely ignoring its dependencies even if its listed in the target, is there anything else I need to do?