File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,27 @@ impl Build {
561561 self
562562 }
563563
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+
564585 /// Removes a compiler flag that was added by [`Build::flag`].
565586 ///
566587 /// Will not remove flags added by other means (default flags,
You can’t perform that action at this time.
0 commit comments