Mr Some Dev.
Mr Some Dev.

Reputation: 315

Change Other Swift Flags gives build error

I'm creating multiple targets for development, test, production, QA etc.. When I do that I want to differentiate this targets by changing "other swift flags". As default, It shows as in below screenshot.

Screenshot

I want to change that "-D" to "Prod". I think because I use Cocoapods, I'm getting build error. My Pods xcconfig file is in below;

ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Alamofire"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

I'm getting below error

:0: error: unknown argument: '-PROD' Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

Upvotes: 2

Views: 1693

Answers (1)

aleixrr
aleixrr

Reputation: 489

When you are adding processor macros you have to define them with the prefix -D so, in your need to add -DPROD, like this

Xcode configuration for Macro

Upvotes: 3

Related Questions