aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2024-03-05 23:42:43 -0800
committerGitHub <noreply@github.com>2024-03-05 23:42:43 -0800
commit744fc221575aa631b1e5c0c2a7272da397919796 (patch)
treeee64ff67c2bfa068036f5ea5ce860282ed834c1b
parent1fd8a5fcaa7ea97532c58f4c9320989d63451f6b (diff)
parent699a12a67a684bcf98af4c9646cb9d65e5373c21 (diff)
downloadcxx-744fc221575aa631b1e5c0c2a7272da397919796.tar.gz
Merge pull request #1321 from dcoles/docs-use-builder-std
Documentation: Use `builder.std` rather than explicit compiler flags
-rw-r--r--README.md2
-rw-r--r--book/src/build/cargo.md2
-rw-r--r--book/src/tutorial.md4
3 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index 883cfe53..694bf2fa 100644
--- a/README.md
+++ b/README.md
@@ -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");
diff --git a/book/src/build/cargo.md b/book/src/build/cargo.md
index 3d82baed..6e9af802 100644
--- a/book/src/build/cargo.md
+++ b/book/src/build/cargo.md
@@ -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");
diff --git a/book/src/tutorial.md b/book/src/tutorial.md
index 9c1b5c2c..cafa24d3 100644
--- a/book/src/tutorial.md
+++ b/book/src/tutorial.md
@@ -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++
@@ -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");
# }
```