Debian Codegraph @

extra/protobuf/protobuf-24.4/build_defs/compiler_config_setting.bzl

raw
1 """Creates config_setting that allows selecting based on 'compiler' value."""
2
3 def create_compiler_config_setting(name, value, visibility = None):
4 # The "do_not_use_tools_cpp_compiler_present" attribute exists to
5 # distinguish between older versions of Bazel that do not support
6 # "@bazel_tools//tools/cpp:compiler" flag_value, and newer ones that do.
7 # In the future, the only way to select on the compiler will be through
8 # flag_values{"@bazel_tools//tools/cpp:compiler"} and the else branch can
9 # be removed.
10 if hasattr(cc_common, "do_not_use_tools_cpp_compiler_present"):
11 native.config_setting(
12 name = name,
13 flag_values = {
14 "@bazel_tools//tools/cpp:compiler": value,
15 },
16 visibility = visibility,
17 )
18 else:
19 native.config_setting(
20 name = name,
21 values = {"compiler": value},
22 visibility = visibility,
23 )