Skip to content

Commit

Permalink
Merge pull request #1321 from dcoles/docs-use-builder-std
Browse files Browse the repository at this point in the history
Documentation: Use `builder.std` rather than explicit compiler flags
  • Loading branch information
dtolnay committed Mar 6, 2024
2 parents 1fd8a5f + 699a12a commit 744fc22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -244,7 +244,7 @@ cxx-build = "1.0"
fn main() {
cxx_build::bridge("src/main.rs") // returns a cc::Build
.file("src/demo.cc")
.flag_if_supported("-std=c++11")
.std("c++11")
.compile("cxxbridge-demo");

println!("cargo:rerun-if-changed=src/main.rs");
Expand Down
2 changes: 1 addition & 1 deletion book/src/build/cargo.md
Expand Up @@ -38,7 +38,7 @@ set up any additional source files and compiler flags as normal.
fn main() {
cxx_build::bridge("src/main.rs") // returns a cc::Build
.file("src/demo.cc")
.flag_if_supported("-std=c++11")
.std("c++11")
.compile("cxxbridge-demo");
println!("cargo:rerun-if-changed=src/main.rs");
Expand Down
4 changes: 2 additions & 2 deletions book/src/tutorial.md
Expand Up @@ -159,7 +159,7 @@ std::unique_ptr<BlobstoreClient> new_blobstore_client() {
}
```

Using `std::make_unique` would work too, as long as you pass `-std=c++14` to the
Using `std::make_unique` would work too, as long as you pass `std("c++14")` to the
C++ compiler as described later on.

The placement in *include/* and *src/* is not significant; you can place C++
Expand Down Expand Up @@ -222,7 +222,7 @@ integration.
# fn main() {
cxx_build::bridge("src/main.rs")
.file("src/blobstore.cc")
.flag_if_supported("-std=c++14")
.std("c++14")
.compile("cxx-demo");
# }
```
Expand Down

0 comments on commit 744fc22

Please sign in to comment.