Skip to content

conditional_variables

Samantha Marshall edited this page Jul 11, 2016 · 3 revisions

Conditional Variables

In additional to variable substitution, xcconfig files have a built-in way to perform assignment based on a condition determined at build-time. The pyconfig language supports this through the keyword if.

Example:

setting OTHER_LDFLAGS {
	if arch=arm* {
		-l"iOSOnlyLibrary"
	}
}

This will be translated into:

OTHER_LDFLAGS[arch=arm*] = -l"iOSOnlyLibrary"

Additionally, you can chain multiple conditions together in a single if statement by using the and keyword:

setting OTHER_LDFLAGS {
	if arch=i386 and sdk=iphone {
		-l"iOSSimulatorOnlyLibrary"
	}
}

To get the resulting xcconfig assignment:

OTHER_LDFLAGS[arch=i386,sdk=iphone] = -l"iOSSimulatorOnlyLibrary"

Clone this wiki locally