SwiftDriver error (case of static lib contains C++ and Swift)

I am getting this error when a static library which contains both Swift and Objective-C++, is used by another library which contains only C++ code. Note that, this issue does not happen when the library is shared as opposed to static.

error: Driver threw unknown argument: '-Wno-used-but-marked-unused' without emitting errors.

The used-but-marked-unused is set like this in a cmake file


Basically that attribute targets C++ compiler and not Swift compiler.

Any idea how to resolve this issue?