diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a59ae19b..0f132a4d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Re-enabled `sparc64-unknown-linux-gnu` image
- #582 - Added `libprocstat.so` to FreeBSD images
- #665 - when not using [env.volumes](https://github.com/cross-rs/cross#mounting-volumes-into-the-build-environment), mount project in /project
+- #494 - Parse Cargo's --manifest-path option to determine mounted docker root
### Removed
diff --git a/README.md b/README.md
index a6adcdb76..becb8b9d6 100644
--- a/README.md
+++ b/README.md
@@ -367,6 +367,9 @@ $ QEMU_STRACE=1 cross run --target aarch64-unknown-linux-gnu
- path dependencies (in Cargo.toml) that point outside the Cargo project won't
work because `cross` use docker containers only mounts the Cargo project so
the container doesn't have access to the rest of the filesystem.
+ However, you may use Cargo's `--manifest-path` option to reference your
+ target crate, executed from a common root directory from which all your
+ dependencies are available.
## Minimum Supported Rust Version (MSRV)
diff --git a/src/cargo.rs b/src/cargo.rs
index 654ed580a..0a288add2 100644
--- a/src/cargo.rs
+++ b/src/cargo.rs
@@ -1,9 +1,12 @@
use serde::Deserialize;
+use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus};
+use crate::cli::Args;
+use crate::config::Config;
use crate::errors::*;
-use crate::extensions::CommandExt;
+use crate::extensions::{CommandExt, OutputExt};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Subcommand {
@@ -52,42 +55,63 @@ impl<'a> From<&'a str> for Subcommand {
}
}
-#[derive(Debug)]
-pub struct Root {
- pub path: PathBuf,
+#[derive(Debug, Deserialize)]
+pub struct CargoMetadata {
+ pub workspace_root: PathBuf,
}
-impl Root {
- pub fn path(&self) -> &Path {
- &self.path
+impl CargoMetadata {
+ pub fn workspace_root(&self) -> &Path {
+ &self.workspace_root
}
}
-/// Cargo project root
-pub fn root(cd: Option<&Path>) -> Result