Skip to content

Commit ad226e6

Browse files
committed
Add no_build_target option
1 parent 4a45b77 commit ad226e6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/lib.rs

100644100755
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub struct Config {
7272
static_crt: Option<bool>,
7373
uses_cxx11: bool,
7474
always_configure: bool,
75+
no_build_target: bool,
7576
}
7677

7778
/// Builds the native library rooted at `path` with the default cmake options.
@@ -115,6 +116,7 @@ impl Config {
115116
static_crt: None,
116117
uses_cxx11: false,
117118
always_configure: true,
119+
no_build_target: false,
118120
}
119121
}
120122

@@ -167,6 +169,12 @@ impl Config {
167169
self
168170
}
169171

172+
/// Disables the target option for this compilation.
173+
pub fn no_build_target(&mut self) -> &mut Config {
174+
self.no_build_target = true;
175+
self
176+
}
177+
170178
/// Sets the host triple for this compilation.
171179
///
172180
/// This is automatically scraped from `$HOST` which is set for Cargo
@@ -557,8 +565,12 @@ impl Config {
557565
if let Some(flags) = makeflags {
558566
cmd.env("MAKEFLAGS", flags);
559567
}
568+
569+
if !self.no_build_target {
570+
cmd.arg("--target").arg(target);
571+
}
572+
560573
run(cmd.arg("--build").arg(".")
561-
.arg("--target").arg(target)
562574
.arg("--config").arg(&profile)
563575
.arg("--").args(&self.build_args)
564576
.args(&parallel_args)

0 commit comments

Comments
 (0)