bazelbazel-query

How to pass custom flags in a `bazel query` command?


I try to query deps with a custom flags. For example,

bazel query --define=using_cuda=true "deps(@org_tensorflow//tensorflow/core:lib)"

Bazel complained:

ERROR: Unrecognized option: --define=using_cuda=true

How could I pass a custom flag to bazel query command?


Solution

  • bazel query doesn't support the --define flag because the command doesn't use it. Instead, use bazel cquery instead, which stands for "configurable query".