Skip to content

Make CARGO_BUILD_TARGET accept multiple target triples #14820

Open
@madsmtm

Description

@madsmtm

Problem

It is really nice that Cargo supports compiling for multiple platform target triples (not to be confused with the artifacts that Cargo produces). However, it is inconvenient that this capability does not extend to CARGO_BUILD_TARGET.

Proposed Solution

Make CARGO_BUILD_TARGET take multiple values, potentially comma-separated, such that CARGO_BUILD_TARGET=aarch64-apple-darwin,aarch64-apple-ios cargo build would work the same as cargo build --target aarch64-apple-darwin --target aarch64-apple-ios.

Perhaps we could even extend --target to allow comma-separated target triples too?

As a bit of prior art, x.py in rust-lang/rust supports comma-separated target triples.

Notes

This wouldn't work with custom target triple paths that contain commas. How common are these? And would it be okay to break, since custom target json specs are unstable anyhow?

This was also discussed in #10473, but nothing further was done about this yet (from my understanding?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsA-cross-compilingArea: using --target flag for other platformsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions