Skip to content

Commit 4998d28

Browse files
authored
Merge pull request #49 from rzumer/master
Add no_build_target option
2 parents 4a45b77 + 90def09 commit 4998d28

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/lib.rs

100644100755
Lines changed: 16 additions & 3 deletions
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, no_build_target: bool) -> &mut Config {
174+
self.no_build_target = no_build_target;
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,9 +565,14 @@ impl Config {
557565
if let Some(flags) = makeflags {
558566
cmd.env("MAKEFLAGS", flags);
559567
}
560-
run(cmd.arg("--build").arg(".")
561-
.arg("--target").arg(target)
562-
.arg("--config").arg(&profile)
568+
569+
cmd.arg("--build").arg(".");
570+
571+
if !self.no_build_target {
572+
cmd.arg("--target").arg(target);
573+
}
574+
575+
run(cmd.arg("--config").arg(&profile)
563576
.arg("--").args(&self.build_args)
564577
.args(&parallel_args)
565578
.current_dir(&build), "cmake");

0 commit comments

Comments
 (0)