Skip to content

Commit c87b731

Browse files
authored
feat: provide configure_args api (#113)
This API is intended to parallel build_args, except to provide additional arguments during the configure stage.
1 parent 2c932e0 commit c87b731

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub struct Config {
6767
host: Option<String>,
6868
out_dir: Option<PathBuf>,
6969
profile: Option<String>,
70+
configure_args: Vec<OsString>,
7071
build_args: Vec<OsString>,
7172
cmake_target: Option<String>,
7273
env: Vec<(OsString, OsString)>,
@@ -188,6 +189,7 @@ impl Config {
188189
out_dir: None,
189190
target: None,
190191
host: None,
192+
configure_args: Vec::new(),
191193
build_args: Vec::new(),
192194
cmake_target: None,
193195
env: Vec::new(),
@@ -318,6 +320,12 @@ impl Config {
318320
self
319321
}
320322

323+
/// Add an argument to the `cmake` configure step
324+
pub fn configure_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Config {
325+
self.configure_args.push(arg.as_ref().to_owned());
326+
self
327+
}
328+
321329
/// Add an argument to the final `cmake` build step
322330
pub fn build_arg<A: AsRef<OsStr>>(&mut self, arg: A) -> &mut Config {
323331
self.build_args.push(arg.as_ref().to_owned());
@@ -727,6 +735,7 @@ impl Config {
727735
}
728736

729737
if self.always_configure || !build.join("CMakeCache.txt").exists() {
738+
cmd.args(&self.configure_args);
730739
run(cmd.env("CMAKE_PREFIX_PATH", cmake_prefix_path), "cmake");
731740
} else {
732741
println!("CMake project was already configured. Skipping configuration step.");

0 commit comments

Comments
 (0)