@@ -55,9 +55,15 @@ def _gcc_toolchain_impl(rctx):
55
55
for v in rctx .attr .target_compatible_with
56
56
]
57
57
58
+ target_settings = [
59
+ v .format (target_arch = target_arch )
60
+ for v in rctx .attr .target_settings
61
+ ]
62
+
58
63
rctx .file ("BUILD.bazel" , _TOOLCHAIN_BUILD_FILE_CONTENT .format (
59
64
gcc_toolchain_workspace_name = rctx .attr .gcc_toolchain_workspace_name ,
60
65
target_compatible_with = str (target_compatible_with ),
66
+ target_settings = str (target_settings ),
61
67
toolchain_files_repository_name = rctx .attr .toolchain_files_repository_name ,
62
68
63
69
# Sysroot
@@ -135,6 +141,11 @@ _FEATURE_ATTRS = {
135
141
doc = "contraint_values passed to target_compatible_with of the toolchain. {target_arch} is rendered to the target_arch attribute value." ,
136
142
mandatory = False ,
137
143
),
144
+ "target_settings" : attr .string_list (
145
+ default = [],
146
+ doc = "config_settings passed to target_compatible_with of the toolchain. {target_arch} is rendered to the target_arch attribute value." ,
147
+ mandatory = False ,
148
+ ),
138
149
"toolchain_files_repository_name" : attr .string (
139
150
doc = "The name of the repository containing the toolchain files." ,
140
151
mandatory = True ,
@@ -570,6 +581,7 @@ toolchain(
570
581
"@platforms//cpu:x86_64",
571
582
],
572
583
target_compatible_with = {target_compatible_with},
584
+ target_settings = {target_settings},
573
585
toolchain = ":_cc_toolchain",
574
586
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
575
587
)
0 commit comments