mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #8391 - bl2e:install-target-dir, r=alexcrichton
Enable "--target-dir" in "cargo install" Issue #8263
This commit is contained in:
commit
fd600f3a40
@ -57,6 +57,7 @@ pub fn cli() -> App {
|
||||
"Install all examples",
|
||||
)
|
||||
.arg_target_triple("Build for the target triple")
|
||||
.arg_target_dir()
|
||||
.arg(opt("root", "Directory to install packages into").value_name("DIR"))
|
||||
.arg(
|
||||
opt("index", "Registry index to install from")
|
||||
|
@ -143,6 +143,8 @@ include::options-features.adoc[]
|
||||
|
||||
include::options-target-triple.adoc[]
|
||||
|
||||
include::options-target-dir.adoc[]
|
||||
|
||||
*--debug*::
|
||||
Build with the `dev` profile instead the `release` profile.
|
||||
|
||||
|
@ -258,6 +258,13 @@ target artifacts are placed in a separate directory. See the
|
||||
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
|
||||
</div>
|
||||
</dd>
|
||||
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
|
||||
<dd>
|
||||
<p>Directory for all generated artifacts and intermediate files. May also be
|
||||
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
|
||||
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
|
||||
to <code>target</code> in the root of the workspace.</p>
|
||||
</dd>
|
||||
<dt class="hdlist1"><strong>--debug</strong></dt>
|
||||
<dd>
|
||||
<p>Build with the <code>dev</code> profile instead the <code>release</code> profile.</p>
|
||||
|
@ -2,12 +2,12 @@
|
||||
.\" Title: cargo-install
|
||||
.\" Author: [see the "AUTHOR(S)" section]
|
||||
.\" Generator: Asciidoctor 2.0.10
|
||||
.\" Date: 2020-06-14
|
||||
.\" Date: 2020-06-20
|
||||
.\" Manual: \ \&
|
||||
.\" Source: \ \&
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "CARGO\-INSTALL" "1" "2020-06-14" "\ \&" "\ \&"
|
||||
.TH "CARGO\-INSTALL" "1" "2020-06-20" "\ \&" "\ \&"
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.ss \n[.ss] 0
|
||||
@ -345,6 +345,16 @@ target artifacts are placed in a separate directory. See the
|
||||
documentation for more details.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-target\-dir\fP \fIDIRECTORY\fP
|
||||
.RS 4
|
||||
Directory for all generated artifacts and intermediate files. May also be
|
||||
specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the
|
||||
\fBbuild.target\-dir\fP \c
|
||||
.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
|
||||
Defaults
|
||||
to \fBtarget\fP in the root of the workspace.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-debug\fP
|
||||
.RS 4
|
||||
Build with the \fBdev\fP profile instead the \fBrelease\fP profile.
|
||||
|
@ -308,6 +308,35 @@ fn install_path() {
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn install_target_dir() {
|
||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
||||
|
||||
p.cargo("install --target-dir td_test")
|
||||
.with_stderr(
|
||||
"\
|
||||
[WARNING] Using `cargo install` [..]
|
||||
[INSTALLING] foo v0.0.1 [..]
|
||||
[COMPILING] foo v0.0.1 [..]
|
||||
[FINISHED] release [..]
|
||||
[INSTALLING] [..]foo[EXE]
|
||||
[INSTALLED] package `foo v0.0.1 [..]foo[..]` (executable `foo[EXE]`)
|
||||
[WARNING] be sure to add [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
|
||||
let mut path = p.root();
|
||||
path.push("td_test");
|
||||
assert!(path.exists());
|
||||
|
||||
#[cfg(not(windows))]
|
||||
path.push("release/foo");
|
||||
#[cfg(windows)]
|
||||
path.push("release/foo.exe");
|
||||
assert!(path.exists());
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn multiple_crates_error() {
|
||||
let p = git::repo(&paths::root().join("foo"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user