List of labels; default is []

A list of constraint_values that must be present in the target platform for this target to be considered compatible. This is in addition to any constraints already set by the rule type. If the target platform does not satisfy all listed constraints then the target is considered incompatible. Incompatible targets are skipped for building and testing when the target pattern is expanded (e.g. //..., :all). When explicitly specified on the command line, incompatible targets cause Bazel to print an error and cause a build or test failure.

Targets that transitively depend on incompatible targets are themselves considered incompatible. They are also skipped for building and testing.

An empty list (which is the default) signifies that the target is compatible with all platforms.

All rules other than Workspace Rules support this attribute. For some rules this attribute has no effect. For example, specifying target_compatible_with for a cc_toolchain is not useful.

See the Platforms page for more information about incompatible target skipping.