aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2020-05-11 20:26:41 -0700
committerDavid Tolnay <dtolnay@gmail.com>2020-05-11 20:30:44 -0700
commit9808ef177cd75eecc30d4241cf604ff8cda2dacc (patch)
tree57c6eef430b5c336acec531cdc2ca8ee3aee56d8 /build.rs
parent14db1e2049ab565122e0a3360a3b10720dd580e0 (diff)
downloadcxx-9808ef177cd75eecc30d4241cf604ff8cda2dacc.tar.gz
Add cargo cfgs for opt in to newer standards
Currently unused, but will be needed when integrating std::optional or std::string_view support. [dependencies] cxx = { version = "0.3", features = ["c++17"] }
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index 9a071fe5..a412dbda 100644
--- a/build.rs
+++ b/build.rs
@@ -3,7 +3,13 @@ fn main() {
.file("src/cxx.cc")
.cpp(true)
.cpp_link_stdlib(None) // linked via link-cplusplus crate
- .flag_if_supported("-std=c++11")
+ .flag_if_supported(if cfg!(feature = "c++17") {
+ "-std=c++17"
+ } else if cfg!(feature = "c++14") {
+ "-std=c++14"
+ } else {
+ "-std=c++11"
+ })
.compile("cxxbridge03");
println!("cargo:rerun-if-changed=src/cxx.cc");
println!("cargo:rerun-if-changed=include/cxx.h");