Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct Config {
uses_cxx11: bool,
always_configure: bool,
no_build_target: bool,
no_default_flags: bool,
verbose_cmake: bool,
verbose_make: bool,
pic: Option<bool>,
Expand Down Expand Up @@ -184,6 +185,7 @@ impl Config {
path: env::current_dir().unwrap().join(path),
generator: None,
generator_toolset: None,
no_default_flags: false,
cflags: OsString::new(),
cxxflags: OsString::new(),
asmflags: OsString::new(),
Expand Down Expand Up @@ -297,6 +299,13 @@ impl Config {
self
}

/// Disables the generation of default compiler flags. The default compiler
/// flags may cause conflicts in some cross compiling scenarios.
pub fn no_default_flags(&mut self, no_default_flags: bool) -> &mut Config {
self.no_default_flags = no_default_flags;
self
}

/// Sets the host triple for this compilation.
///
/// This is automatically scraped from `$HOST` which is set for Cargo
Expand Down Expand Up @@ -515,7 +524,7 @@ impl Config {
.debug(false)
.warnings(false)
.host(&host)
.no_default_flags(ndk);
.no_default_flags(ndk || self.no_default_flags);
if !ndk {
c_cfg.target(&target);
}
Expand All @@ -527,7 +536,7 @@ impl Config {
.debug(false)
.warnings(false)
.host(&host)
.no_default_flags(ndk);
.no_default_flags(ndk || self.no_default_flags);
if !ndk {
cxx_cfg.target(&target);
}
Expand Down