@@ -75,7 +75,7 @@ pub struct Config {
75
75
env : Vec < ( OsString , OsString ) > ,
76
76
compiler : Option < PathBuf > ,
77
77
archiver : Option < PathBuf > ,
78
- link : bool ,
78
+ cargo_metadata : bool ,
79
79
}
80
80
81
81
fn getenv ( v : & str ) -> Option < String > {
@@ -134,7 +134,7 @@ impl Config {
134
134
env : Vec :: new ( ) ,
135
135
compiler : None ,
136
136
archiver : None ,
137
- link : true
137
+ cargo_metadata : true
138
138
}
139
139
}
140
140
@@ -288,13 +288,10 @@ impl Config {
288
288
self . archiver = Some ( archiver. as_ref ( ) . to_owned ( ) ) ;
289
289
self
290
290
}
291
- /// Define whether the compiled archive will automatically be linked.
292
- ///
293
- /// If you don't want the compiled archive to be linked into the rust
294
- /// binary automatically, you can set this option to `false`. It can
295
- /// still be linked explicitly using the `#[cfg(link())]` directive.
296
- pub fn link ( & mut self , link : bool ) -> & mut Config {
297
- self . link = link;
291
+ /// Define whether metadata should be emitted for cargo allowing it to
292
+ /// automatically link the binary. Defaults to `true`.
293
+ pub fn cargo_metadata ( & mut self , cargo_metadata : bool ) -> & mut Config {
294
+ self . cargo_metadata = cargo_metadata;
298
295
self
299
296
}
300
297
@@ -324,16 +321,18 @@ impl Config {
324
321
}
325
322
326
323
self . assemble ( lib_name, & dst. join ( output) , & objects) ;
327
- println ! ( "cargo:rustc-link-search=native={}" , dst . display ( ) ) ;
328
- if self . link {
324
+
325
+ if self . cargo_metadata {
329
326
println ! ( "cargo:rustc-link-lib=static={}" ,
330
327
& output[ 3 ..output. len( ) - 2 ] ) ;
331
- }
328
+ println ! ( "cargo:rustc-link-search=native={}" , dst. display( ) ) ;
329
+
330
+ // Add specific C++ libraries, if enabled.
331
+ if self . cpp {
332
+ if let Some ( stdlib) = self . get_cpp_link_stdlib ( ) {
333
+ println ! ( "cargo:rustc-link-lib={}" , stdlib) ;
334
+ }
332
335
333
- // Add specific C++ libraries, if enabled.
334
- if self . cpp {
335
- if let Some ( stdlib) = self . get_cpp_link_stdlib ( ) {
336
- println ! ( "cargo:rustc-link-lib={}" , stdlib) ;
337
336
}
338
337
}
339
338
}
0 commit comments