Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,27 @@ impl Build {
self
}

/// Add multiple flags to the invocation of the compiler.
/// This is equivalent to calling [`flag`](Self::flag) for each item in the iterator.
///
/// # Example
/// ```no_run
/// cc::Build::new()
/// .file("src/foo.c")
/// .flags(["-Wall", "-Wextra"])
/// .compile("foo");
/// ```
pub fn flags<Iter>(&mut self, flags: Iter) -> &mut Build
where
Iter: IntoIterator,
Iter::Item: AsRef<OsStr>,
{
for flag in flags {
self.flag(flag);
}
self
}

/// Removes a compiler flag that was added by [`Build::flag`].
///
/// Will not remove flags added by other means (default flags,
Expand Down
Loading