We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
flags
cc::Build
1 parent 0342d85 commit f50ff26Copy full SHA for f50ff26
src/lib.rs
@@ -561,6 +561,27 @@ impl Build {
561
self
562
}
563
564
+ /// Add multiple flags to the invocation of the compiler.
565
+ /// This is equivalent to calling [`flag`](Self::flag) for each item in the iterator.
566
+ ///
567
+ /// # Example
568
+ /// ```no_run
569
+ /// cc::Build::new()
570
+ /// .file("src/foo.c")
571
+ /// .flags(["-Wall", "-Wextra"])
572
+ /// .compile("foo");
573
+ /// ```
574
+ pub fn flags<Iter>(&mut self, flags: Iter) -> &mut Build
575
+ where
576
+ Iter: IntoIterator,
577
+ Iter::Item: AsRef<OsStr>,
578
+ {
579
+ for flag in flags {
580
+ self.flag(flag);
581
+ }
582
+ self
583
584
+
585
/// Removes a compiler flag that was added by [`Build::flag`].
586
///
587
/// Will not remove flags added by other means (default flags,
0 commit comments