-1

My project structure is something like this:

├── build_bin_a.rs
├── Cargo.lock
├── Cargo.toml
├── crates
│   ├── some-crate-a
│   ├── some-crate-b
│   └── .... #etc
├── src
│    ├── bin
│    │   └── some_bin_a.rs
│    │   └── some_bin_b.rs
│    └── lib.rs
└── ...

And I need to configure a build script for only one binary target. In this case I need to configure build_bin_a.rs build script for src/bin/some-bin-a.rs binary target.

Is there any way to achieve it?

6
  • 1
    What do you mean by 'configure a build script' does it need different settings for that single target? Do you want it to run only for that target? Commented Aug 26, 2023 at 23:49
  • 1
    exactly I want to execute this build script only for that single target. I mean, I don't want the build script to run unless I build that binary target. Commented Aug 26, 2023 at 23:50
  • 2
    This question is about dependencies, but the solutions are similar to your issue: stackoverflow.com/q/35711044/6274355 Commented Aug 27, 2023 at 0:01
  • 1
    thanks probably the closest thing to what I need is to turn the binary as its own package, although it would not be ideal because I do not want to complicate more the structure of my project, but for now I think it works for me. Commented Aug 27, 2023 at 0:06
  • 3
    @al3x Can you please stop rolling-back the tag edits? cargo IS THE WRONG TAG to use for the Rust package manager. You should use rust-cargo instead. Consult the tag descriptions if you need more convincing. Continuing to do so can be seen as vandalism, which is not allowed even on your own posts. Commented Dec 9, 2023 at 17:20

1 Answer 1

2

This is issue #1430, not supported currently. Your best bet is to put the binary in a different package.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.