@@ -114,6 +114,7 @@ pub struct Build {
114114 compiler : Option < PathBuf > ,
115115 archiver : Option < PathBuf > ,
116116 cargo_metadata : bool ,
117+ link_lib_modifiers : Option < String > ,
117118 pic : Option < bool > ,
118119 use_plt : Option < bool > ,
119120 static_crt : Option < bool > ,
@@ -312,6 +313,7 @@ impl Build {
312313 compiler : None ,
313314 archiver : None ,
314315 cargo_metadata : true ,
316+ link_lib_modifiers : None ,
315317 pic : None ,
316318 use_plt : None ,
317319 static_crt : None ,
@@ -898,6 +900,14 @@ impl Build {
898900 self
899901 }
900902
903+ /// Configures native library modifiers that will be added to the
904+ /// `rustc-link-lib=static:MODIFIERS=LIBRARY_NAME` metadata line
905+ /// emitted for cargo if `cargo_metadata` is enabled.
906+ pub fn link_lib_modifiers ( & mut self , link_lib_modifiers : & str ) -> & mut Build {
907+ self . link_lib_modifiers = Some ( link_lib_modifiers. to_string ( ) ) ;
908+ self
909+ }
910+
901911 /// Configures whether the compiler will emit position independent code.
902912 ///
903913 /// This option defaults to `false` for `windows-gnu` and bare metal targets and
@@ -1014,7 +1024,10 @@ impl Build {
10141024 }
10151025 }
10161026
1017- self . print ( & format ! ( "cargo:rustc-link-lib=static={}" , lib_name) ) ;
1027+ match & self . link_lib_modifiers {
1028+ Some ( m) => self . print ( & format ! ( "cargo:rustc-link-lib=static:{}={}" , m, lib_name) ) ,
1029+ None => self . print ( & format ! ( "cargo:rustc-link-lib=static={}" , lib_name) ) ,
1030+ }
10181031 self . print ( & format ! ( "cargo:rustc-link-search=native={}" , dst. display( ) ) ) ;
10191032
10201033 // Add specific C++ libraries, if enabled.
0 commit comments