gpt4 book ai didi

rust - 如何指定自定义 Cargo 输出目录?

转载 作者:行者123 更新时间:2023-11-29 07:57:22 27 4
gpt4 key购买 nike

我把它放在我的 Cargo.toml 中

[build]
target-dir = "../my-target"

但是,Cargo 无法识别此 key 。

cargo run --release --bin my_project

warning: unused manifest key: build
error: failed to open: /.../project-root/target/releases/.cargo-lock

Caused by:
Permission denied (os error 13)

带有环境变量的自定义目标目录有效:

CARGO_TARGET_DIR=../my-target cargo run --bin my_project

但是我如何在 Cargo.toml 中指定 '../my-target'?

最佳答案

[build] 是一个 Cargo-level configuration而不是为了项目:

This document will explain how Cargo’s configuration system works, as well as available keys or configuration. For configuration of a project through its manifest, see the manifest format.

将您的 [build] 放入 $PROJECT_DIR/.cargo/config 甚至 $HOME/.cargo/config 中。有关所有选项,请参阅上面的链接。

关于rust - 如何指定自定义 Cargo 输出目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50364390/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com