Compiler flags in Package.swift

This would be very helpful. I was wanting this feature the other day and was going to ask if this had been discussed yet.

The use case I had was when working on a project that is both a Swift Package and Xcode Framework that depend on C code in the same git repository. I have it setup such that the C code is one target of the Package and the Swift target depends on the C target.

But this resulted in me needing to use import to get my C module when compiling with swift build and the import being invalid when compiling with Xcode and the need for different #import statements in the C code. I could have made the Xcode project compile in such a way that it uses import as well, but I've had undefined symbol issues when sharing the framework binary with other people when taking that approach, so I avoid it.

My solution was to make swift build just work by doing the extra flags in Xcode by passing in -DXCODE_FRAMEWORK=1 to both C and Swift. Then using #if to determine if I import the C module and how to #import my headers.

In addition to per target basis it would be nice if you could specify flags for different compilation modes such as debug and release. I have seen quite a few people suggest adding -DDebug as a debug swift build flag for Xcode projects so you can use #if Debug to make decisions.