@@ -77,6 +77,7 @@ pub struct Config {
77
77
uses_cxx11 : bool ,
78
78
always_configure : bool ,
79
79
no_build_target : bool ,
80
+ no_default_flags : bool ,
80
81
verbose_cmake : bool ,
81
82
verbose_make : bool ,
82
83
pic : Option < bool > ,
@@ -184,6 +185,7 @@ impl Config {
184
185
path : env:: current_dir ( ) . unwrap ( ) . join ( path) ,
185
186
generator : None ,
186
187
generator_toolset : None ,
188
+ no_default_flags : false ,
187
189
cflags : OsString :: new ( ) ,
188
190
cxxflags : OsString :: new ( ) ,
189
191
asmflags : OsString :: new ( ) ,
@@ -297,6 +299,13 @@ impl Config {
297
299
self
298
300
}
299
301
302
+ /// Disables the generation of default compiler flags. The default compiler
303
+ /// flags may cause conflicts in some cross compiling scenarios.
304
+ pub fn no_default_flags ( & mut self , no_default_flags : bool ) -> & mut Config {
305
+ self . no_default_flags = no_default_flags;
306
+ self
307
+ }
308
+
300
309
/// Sets the host triple for this compilation.
301
310
///
302
311
/// This is automatically scraped from `$HOST` which is set for Cargo
@@ -515,7 +524,7 @@ impl Config {
515
524
. debug ( false )
516
525
. warnings ( false )
517
526
. host ( & host)
518
- . no_default_flags ( ndk) ;
527
+ . no_default_flags ( ndk || self . no_default_flags ) ;
519
528
if !ndk {
520
529
c_cfg. target ( & target) ;
521
530
}
@@ -527,7 +536,7 @@ impl Config {
527
536
. debug ( false )
528
537
. warnings ( false )
529
538
. host ( & host)
530
- . no_default_flags ( ndk) ;
539
+ . no_default_flags ( ndk || self . no_default_flags ) ;
531
540
if !ndk {
532
541
cxx_cfg. target ( & target) ;
533
542
}
0 commit comments