Buck: read_config()
Support Ukraine. Help Provide Humanitarian Aid to Ukraine.

read_config()

This is liable to change in the future.

The read_config() function is used to read .buckconfig settings from within a build file.

Arguments

  • section The first argument is the name of the .buckconfig section with the desired value.
  • field The second argument is the name of the .buckconfig field with the desired value.
  • default (defaults to None) The third argument is a value to return if the desired value is not set in the .buckconfig.

Examples

Use read_config() to define a custom config setting to enable address sanitizer:
cflags = []

sanitizer = read_config('cxx', 'sanitizer')
if sanitizer == 'address':
    cflags.append('-fsanitize=address')

cxx_binary(
  name = 'example',
  # ...
  compiler_flags = cflags,
)