blob: 5e52a6524ffe5f8522a815cff6921c663e48078d [file] [log] [blame]
scentini664f9272018-08-28 14:10:46 +02001"""Creates config_setting that allows selecting based on 'compiler' value."""
2
3def create_compiler_config_setting(name, value):
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 )
17 else:
18 native.config_setting(
19 name = name,
20 values = {"compiler": value},
21 )