Passing compilation flags to local Swift packages

I have a project that uses a dozen of local Swift packages and I am trying to find a way of passing some compilation flags when building those packages from Xcode. Unfortunately, setting SWIFT_ACTIVE_COMPILATION_CONDITIONS has no effect when compiling packages.

It is possible, of course, to do that in the swiftSettings target argument in a manifest file or directly using swift build -Xswiftc, but I need to set the flags based on different build configurations.

Is there a way of configuring the xcodebuild tool the way that the flags are passed to package compiler invocations?

1 Like

It seems like it was done like this by design, and xcodebuild intentionally ignores setting active compilation conditions for custom build configurations when it comes to compiling packages (expectedly it works only for the predefined debug build configuration). I will probably have to resort to using environment variables to set the flags conditionally in the package manifest file for now.

1 Like
Terms of Service

Privacy Policy

Cookie Policy