read_config()
This is liable to change in the future.
Theread_config() function is used to read .buckconfig settings from within a build file.Arguments
sectionThe first argument is the name of the.buckconfigsection with the desired value.fieldThe second argument is the name of the.buckconfigfield with the desired value.default(defaults toNone) The third argument is a value to return if the desired value is not set in the.buckconfig.
Examples
Useread_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,
)