@@ -77,6 +77,7 @@ pub struct Config {
7777 uses_cxx11 : bool ,
7878 always_configure : bool ,
7979 no_build_target : bool ,
80+ no_default_flags : bool ,
8081 verbose_cmake : bool ,
8182 verbose_make : bool ,
8283 pic : Option < bool > ,
@@ -184,6 +185,7 @@ impl Config {
184185 path : env:: current_dir ( ) . unwrap ( ) . join ( path) ,
185186 generator : None ,
186187 generator_toolset : None ,
188+ no_default_flags : false ,
187189 cflags : OsString :: new ( ) ,
188190 cxxflags : OsString :: new ( ) ,
189191 asmflags : OsString :: new ( ) ,
@@ -297,6 +299,13 @@ impl Config {
297299 self
298300 }
299301
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+
300309 /// Sets the host triple for this compilation.
301310 ///
302311 /// This is automatically scraped from `$HOST` which is set for Cargo
@@ -515,7 +524,7 @@ impl Config {
515524 . debug ( false )
516525 . warnings ( false )
517526 . host ( & host)
518- . no_default_flags ( ndk) ;
527+ . no_default_flags ( ndk || self . no_default_flags ) ;
519528 if !ndk {
520529 c_cfg. target ( & target) ;
521530 }
@@ -527,7 +536,7 @@ impl Config {
527536 . debug ( false )
528537 . warnings ( false )
529538 . host ( & host)
530- . no_default_flags ( ndk) ;
539+ . no_default_flags ( ndk || self . no_default_flags ) ;
531540 if !ndk {
532541 cxx_cfg. target ( & target) ;
533542 }
0 commit comments