@@ -1592,7 +1592,7 @@ private class SettingsBuilder {
15921592 if let sdk = boundProperties. sdk, settingsContext. purpose. bindToSDK {
15931593 for property in impartedBuildProperties ?? [ ] {
15941594 // Imparted build properties are always from packages, so force allow platform filter conditionals.
1595- bindConditionParameters ( property. buildSettings, sdk, forceAllowPlatformFilterCondition: true )
1595+ bindConditionParameters ( bindTargetCondition ( property. buildSettings) , sdk, forceAllowPlatformFilterCondition: true )
15961596 }
15971597 }
15981598
@@ -2751,6 +2751,14 @@ private class SettingsBuilder {
27512751 }
27522752 }
27532753
2754+ func bindTargetCondition( _ table: MacroValueAssignmentTable ) -> MacroValueAssignmentTable {
2755+ if let target {
2756+ return table. bindConditionParameter ( BuiltinMacros . targetNameCondition, [ target. name] )
2757+ } else {
2758+ return table
2759+ }
2760+ }
2761+
27542762 /// Add the regular project settings.
27552763 func addProjectSettings( _ config: BuildConfiguration , _ sdk: SDK ? = nil ) {
27562764 guard let project else {
@@ -2781,11 +2789,11 @@ private class SettingsBuilder {
27812789 // Load and push a settings table from the file.
27822790 let info = buildRequestContext. getCachedMacroConfigFile ( path, project: project, context: . baseConfiguration)
27832791 if let sdk = sdk, settingsContext. purpose. bindToSDK {
2784- bindConditionParameters ( info. table, sdk)
2792+ bindConditionParameters ( bindTargetCondition ( info. table) , sdk)
27852793 }
27862794 else {
27872795 // No bound SDK, so push the project's build settings unmodified.
2788- push ( info. table, . exported)
2796+ push ( bindTargetCondition ( info. table) , . exported)
27892797 }
27902798 self . diagnostics. append ( contentsOf: info. diagnostics)
27912799 for path in info. dependencyPaths {
@@ -2810,11 +2818,11 @@ private class SettingsBuilder {
28102818
28112819 // Add the project's config settings.
28122820 if let sdk, settingsContext. purpose. bindToSDK {
2813- bindConditionParameters ( config. buildSettings, sdk)
2821+ bindConditionParameters ( bindTargetCondition ( config. buildSettings) , sdk)
28142822 }
28152823 else {
28162824 // No bound SDK, so push the project's build settings unmodified.
2817- push ( config. buildSettings, . exported)
2825+ push ( bindTargetCondition ( config. buildSettings) , . exported)
28182826 }
28192827
28202828 // Save the settings table as part of the construction components.
@@ -2996,11 +3004,11 @@ private class SettingsBuilder {
29963004 // Load and push a settings table from the file.
29973005 let info = buildRequestContext. getCachedMacroConfigFile ( path, project: project, context: . baseConfiguration)
29983006 if let sdk = sdk, settingsContext. purpose. bindToSDK {
2999- bindConditionParameters ( info. table, sdk)
3007+ bindConditionParameters ( bindTargetCondition ( info. table) , sdk)
30003008 }
30013009 else {
30023010 // No bound SDK, so push the target xcconfig's build settings unmodified.
3003- push ( info. table, . exported)
3011+ push ( bindTargetCondition ( info. table) , . exported)
30043012 }
30053013 self . targetDiagnostics. append ( contentsOf: info. diagnostics)
30063014 for path in info. dependencyPaths {
@@ -3019,11 +3027,11 @@ private class SettingsBuilder {
30193027 //
30203028 // FIXME: Cache this table, but we can only do that once we share the namespace.
30213029 if let sdk, settingsContext. purpose. bindToSDK {
3022- bindConditionParameters ( config. buildSettings, sdk)
3030+ bindConditionParameters ( bindTargetCondition ( config. buildSettings) , sdk)
30233031 }
30243032 else {
30253033 // No bound SDK, so push the target's build settings unmodified.
3026- push ( config. buildSettings, . exported)
3034+ push ( bindTargetCondition ( config. buildSettings) , . exported)
30273035 }
30283036
30293037 addSpecializationOverrides ( sdk: sdk, usesAutomaticSDK: usesAutomaticSDK)
0 commit comments