Improve documentation on using cfg values with build scripts #12198
Labels
A-build-scripts
Area: build.rs scripts
A-documenting-cargo-itself
Area: Cargo's documentation
S-accepted
Status: Issue or feature is accepted, and has a team member available to help mentor or review
The docs don't clearly specify how to properly read cfg values in a build script:
Some things I think might be good to cover:
cfg!
or#[cfg]
for target-related configs (only host-related to the build script itself).TARGET
env for specific values, use theCARGO_CFG_*
values instead.This would be relevant on these pages:
The environment variables page could contain a link to the build-script-examples page that shows how to use them.
Some discussion here: https://internals.rust-lang.org/t/futher-extensions-to-cfg-target-family-and-concerns-about-breakage/16313
The text was updated successfully, but these errors were encountered: