Skip to content

Commit 9c1b9d9

Browse files
author
William Page
committed
Set cargo cwd to manifest dir, workaround for cargo issue 10098
Cargo documentation for configuration toml says that a .cargo/config checked into revision control in the project root should be picked up by cargo, but in fact cargo only searches relative to cwd. In order to achieve the documented result, cargo needs to be invoked with the current working directory already set to the directory containing the manifest file. see rust-lang/cargo#10098
1 parent c654f5c commit 9c1b9d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

classes/cargo.bbclass

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ oe_cargo_build () {
4343
bbnote "cargo = $(which ${CARGO})"
4444
bbnote "rustc = $(which ${RUSTC})"
4545
bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
46-
"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
46+
# This is needed to pick up .cargo/config.toml in the project git root
47+
# see https://github.com/rust-lang/cargo/issues/10098
48+
CARGO_WORKINGDIR="$(dirname "${MANIFEST_PATH}")"
49+
(cd "${CARGO_WORKINGDIR}"; "${CARGO}" build ${CARGO_BUILD_FLAGS} "$@")
4750
}
4851

4952
do_compile[progress] = "outof:\s+(\d+)/(\d+)"

0 commit comments

Comments
 (0)