Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to conditionally compile from a workspace #108251

Closed
Firstyear opened this issue Feb 20, 2023 · 2 comments
Closed

Ability to conditionally compile from a workspace #108251

Firstyear opened this issue Feb 20, 2023 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@Firstyear
Copy link
Contributor

Hi there,

We have recently been having an issue where we can't easily select components for compilation from a workspace based on target_family. We have a generic server binary that can run on all platforms, and two platform/target specific tools for unix vs windows.

What we would like is a way to say:

[workspace]

members = [
    "generic_server"
]

[workspace.cfg(target_family = "unix")]
members += [
    "unix tool"
]

[workspace.cfg(target_family = "windows")]
members += [
    "windows tool"
]

However, we can't find a way to do this effectively, and even within the tools, we can't do target conditional compilation for libs or bins. This means we are left trying to do cfg based on target family inside the libs and binaries instead which feels a bit messy to us. The alternate is to "de-workspace" our project, but then we lose valuable maintenance features like workspace specified dependencies.

I think it would be a significant improvement for rust/cargo to support such conditional compilation rules in workspaces.

@Firstyear Firstyear added the C-bug Category: This is a bug. label Feb 20, 2023
@workingjubilee
Copy link
Member

Since this is about a Cargo-only feature, this probably should have been opened against https://github.com/rust-lang/cargo/issues.

@Firstyear
Copy link
Contributor Author

rust-lang/cargo#11742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants