Skip to content

Commit

Permalink
Fix multiple-definition error on windows_config_setting (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
novas0x2a authored Aug 25, 2023
1 parent 816905a commit 7b67354
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions foreign_cc/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,

tags = kwargs.pop("tags", [])

config_setting_name = name + "_windows_config_setting"

# filegroups cannot select on constraint_values in before Bazel 5.1. Add this config_setting as a workaround. See https://github.com/bazelbuild/bazel/issues/13047
native.config_setting(
name = "windows_config_setting",
name = config_setting_name,
constraint_values = [
"@platforms//os:windows",
],
Expand All @@ -35,7 +37,7 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False,
srcs = [foreign_cc_target],
tags = tags + ["manual"],
output_group = select({
":windows_config_setting": binary + ".exe",
":" + config_setting_name: binary + ".exe",
"//conditions:default": binary,
}),
)
Expand Down

0 comments on commit 7b67354

Please sign in to comment.