Skip to content

Allow specifying cfg expressions for lib targets #4900

Closed as not planned
Closed as not planned
@ghost

Description

Hi! It looks like it's not possible to specify architecture-specific fields for a lib target. I tried adding a [target.'cfg(any(target_os="android", target_os="ios"))'.lib] section to Cargo.toml, as in mozilla/toodle#10 (comment), but Cargo warns that it's an unused manifest key.

In case it helps, the crate in question, toodle, is a library that's cross-compiled for iOS and Android, and also imported as a regular Rust crate by another crate (toodlext). crate-type = ["staticlib", "cdylib"] seems to be necessary for cross-compiling (cargo lipo fails without it), but leaving it under lib breaks toodlext, with cargo build complaining that it can't find the toodle crate (kitcambridge/sync-storage-prototype#1).

/cc @fluffyemily

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-compilingArea: using --target flag for other platformsA-manifestArea: Cargo.toml issuesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions