File tree Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ pub fn cli() -> App {
57
57
"Install all examples" ,
58
58
)
59
59
. arg_target_triple ( "Build for the target triple" )
60
+ . arg_target_dir ( )
60
61
. arg ( opt ( "root" , "Directory to install packages into" ) . value_name ( "DIR" ) )
61
62
. arg (
62
63
opt ( "index" , "Registry index to install from" )
Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ include::options-features.adoc[]
143
143
144
144
include::options-target-triple.adoc[]
145
145
146
+ include::options-target-dir.adoc[]
147
+
146
148
*--debug*::
147
149
Build with the `dev` profile instead the `release` profile.
148
150
Original file line number Diff line number Diff line change @@ -258,6 +258,13 @@ <h3 id="cargo_install_compilation_options">Compilation Options</h3>
258
258
< a href ="../guide/build-cache.html "> build cache</ a > documentation for more details.</ p >
259
259
</ div >
260
260
</ dd >
261
+ < dt class ="hdlist1 "> < strong > --target-dir</ strong > < em > DIRECTORY</ em > </ dt >
262
+ < dd >
263
+ < p > Directory for all generated artifacts and intermediate files. May also be
264
+ specified with the < code > CARGO_TARGET_DIR</ code > environment variable, or the
265
+ < code > build.target-dir</ code > < a href ="../reference/config.html "> config value</ a > . Defaults
266
+ to < code > target</ code > in the root of the workspace.</ p >
267
+ </ dd >
261
268
< dt class ="hdlist1 "> < strong > --debug</ strong > </ dt >
262
269
< dd >
263
270
< p > Build with the < code > dev</ code > profile instead the < code > release</ code > profile.</ p >
Original file line number Diff line number Diff line change 2
2
.\" Title: cargo-install
3
3
.\" Author: [see the "AUTHOR(S)" section]
4
4
.\" Generator: Asciidoctor 2.0.10
5
- .\" Date: 2020-06-14
5
+ .\" Date: 2020-06-20
6
6
.\" Manual: \ \&
7
7
.\" Source: \ \&
8
8
.\" Language: English
9
9
.\"
10
- .TH "CARGO\- INSTALL" "1" "2020-06-14 " "\ \& " "\ \& "
10
+ .TH "CARGO\- INSTALL" "1" "2020-06-20 " "\ \& " "\ \& "
11
11
.ie \n( .g .ds Aq \(aq
12
12
.el .ds Aq '
13
13
.ss \n[ .ss ] 0
@@ -345,6 +345,16 @@ target artifacts are placed in a separate directory. See the
345
345
documentation for more details.
346
346
.RE
347
347
.sp
348
+ \fB \-\- target \- dir \fP \fI DIRECTORY \fP
349
+ .RS 4
350
+ Directory for all generated artifacts and intermediate files. May also be
351
+ specified with the \fB CARGO_TARGET_DIR \fP environment variable, or the
352
+ \fB build.target \- dir \fP \c
353
+ .URL " https://doc.rust\- lang.org/cargo/reference/config.html" " config value" " ."
354
+ Defaults
355
+ to \fB target \fP in the root of the workspace.
356
+ .RE
357
+ .sp
348
358
\fB \-\- debug \fP
349
359
.RS 4
350
360
Build with the \fB dev \fP profile instead the \fB release \fP profile.
Original file line number Diff line number Diff line change @@ -308,6 +308,35 @@ fn install_path() {
308
308
. run ( ) ;
309
309
}
310
310
311
+ #[ cargo_test]
312
+ fn install_target_dir ( ) {
313
+ let p = project ( ) . file ( "src/main.rs" , "fn main() {}" ) . build ( ) ;
314
+
315
+ p. cargo ( "install --target-dir td_test" )
316
+ . with_stderr (
317
+ "\
318
+ [WARNING] Using `cargo install` [..]
319
+ [INSTALLING] foo v0.0.1 [..]
320
+ [COMPILING] foo v0.0.1 [..]
321
+ [FINISHED] release [..]
322
+ [INSTALLING] [..]foo[EXE]
323
+ [INSTALLED] package `foo v0.0.1 [..]foo[..]` (executable `foo[EXE]`)
324
+ [WARNING] be sure to add [..]
325
+ " ,
326
+ )
327
+ . run ( ) ;
328
+
329
+ let mut path = p. root ( ) ;
330
+ path. push ( "td_test" ) ;
331
+ assert ! ( path. exists( ) ) ;
332
+
333
+ #[ cfg( not( windows) ) ]
334
+ path. push ( "release/foo" ) ;
335
+ #[ cfg( windows) ]
336
+ path. push ( "release/foo.exe" ) ;
337
+ assert ! ( path. exists( ) ) ;
338
+ }
339
+
311
340
#[ cargo_test]
312
341
fn multiple_crates_error ( ) {
313
342
let p = git:: repo ( & paths:: root ( ) . join ( "foo" ) )
You can’t perform that action at this time.
0 commit comments