Skip to content

`--target` in cargo commands only works if we enter the package folder

Notifications You must be signed in to change notification settings

os-checker/MRE-cargo-manifest-path-or-p-args

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

For .cargo configuration inside a member package:

# inner/.cargo/config.toml
[build]
target = "riscv64gc-unknown-none-elf"

Enter the package folder to run cargo commands, then we get correct build target:

target/riscv64gc-unknown-none-elf 👈 /doc/inner/index.html

outer/inner $ cargo doc
 Documenting inner v0.1.0 (/rust/tmp/outer/inner)
   Generated /rust/tmp/outer/target/riscv64gc-unknown-none-elf/doc/inner/index.html

But if we run cargo commands from workspace root, since there is no .cargo configuration, cargo won't notice the inner configuration even if -p or --manifest-path is specified:

outer $ cargo doc -p inner
 Documenting inner v0.1.0 (/rust/tmp/outer/inner)
   Generated /rust/tmp/outer/target/doc/inner/index.html

outer $ cargo doc --manifest-path inner/Cargo.toml 
   Generated /rust/tmp/outer/target/doc/inner/index.html

About

`--target` in cargo commands only works if we enter the package folder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages