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 {
5757 "Install all examples" ,
5858 )
5959 . arg_target_triple ( "Build for the target triple" )
60+ . arg_target_dir ( )
6061 . arg ( opt ( "root" , "Directory to install packages into" ) . value_name ( "DIR" ) )
6162 . arg (
6263 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[]
143143
144144include::options-target-triple.adoc[]
145145
146+ include::options-target-dir.adoc[]
147+
146148*--debug*::
147149 Build with the `dev` profile instead the `release` profile.
148150
Original file line number Diff line number Diff line change @@ -258,6 +258,13 @@ <h3 id="cargo_install_compilation_options">Compilation Options</h3>
258258< a href ="../guide/build-cache.html "> build cache</ a > documentation for more details.</ p >
259259</ div >
260260</ 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 >
261268< dt class ="hdlist1 "> < strong > --debug</ strong > </ dt >
262269< dd >
263270< 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 22.\" Title: cargo-install
33.\" Author: [see the "AUTHOR(S)" section]
44.\" Generator: Asciidoctor 2.0.10
5- .\" Date: 2020-06-14
5+ .\" Date: 2020-06-20
66.\" Manual: \ \&
77.\" Source: \ \&
88.\" Language: English
99.\"
10- .TH "CARGO\- INSTALL" "1" "2020-06-14 " "\ \& " "\ \& "
10+ .TH "CARGO\- INSTALL" "1" "2020-06-20 " "\ \& " "\ \& "
1111.ie \n( .g .ds Aq \(aq
1212.el .ds Aq '
1313.ss \n[ .ss ] 0
@@ -345,6 +345,16 @@ target artifacts are placed in a separate directory. See the
345345documentation for more details.
346346.RE
347347.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
348358\fB \-\- debug \fP
349359.RS 4
350360Build 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() {
308308 . run ( ) ;
309309}
310310
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+
311340#[ cargo_test]
312341fn multiple_crates_error ( ) {
313342 let p = git:: repo ( & paths:: root ( ) . join ( "foo" ) )
You can’t perform that action at this time.
0 commit comments