Skip to content

Commit

Permalink
Merge branch 'master' of github.com:alexcrichton/cmake-rs into cmake-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
simlay committed Mar 23, 2020
2 parents 93ff3a1 + 7f85e32 commit 49c1f3c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct Config {
no_build_target: bool,
verbose_cmake: bool,
verbose_make: bool,
pic: Option<bool>,
}

/// Builds the native library rooted at `path` with the default cmake options.
Expand Down Expand Up @@ -128,9 +129,16 @@ impl Config {
no_build_target: false,
verbose_cmake: false,
verbose_make: false,
pic: None,
}
}

/// Sets flag for PIC. Otherwise use cc::Build platform default
pub fn pic(&mut self, explicit_flag: bool) -> &mut Config {
self.pic = Some(explicit_flag);
self
}

/// Sets the build-tool generator (`-G`) for this compilation.
pub fn generator<T: AsRef<OsStr>>(&mut self, generator: T) -> &mut Config {
self.generator = Some(generator.as_ref().to_owned());
Expand Down Expand Up @@ -351,6 +359,10 @@ impl Config {
c_cfg.static_crt(static_crt);
cxx_cfg.static_crt(static_crt);
}
if let Some(explicit_flag) = self.pic {
c_cfg.pic(explicit_flag);
cxx_cfg.pic(explicit_flag);
}
let c_compiler = c_cfg.get_compiler();
let cxx_compiler = cxx_cfg.get_compiler();
let asm_compiler = c_cfg.get_compiler();
Expand Down

0 comments on commit 49c1f3c

Please sign in to comment.