-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit method to specify C/C++ standard #565
Comments
Wilfred
added a commit
to Wilfred/difftastic
that referenced
this issue
Dec 5, 2021
There's no helper in the cc crate for this, but it's been proposed: rust-lang/cc-rs#565 Hopefully will improve #67
The simplest thing you can do right now is something like this: if build.get_compiler().is_like_msvc() {
build.flag("/std:c++17")
} else {
build.flag("-std=c++17")
} But it doesn't solve the issues you mention with unusual versions… Do you think it's be useful to have this even if it only supports the simple cases? If so, I might contribute a fix for this myself, because I need this flag for one of my projects. |
I decided to just do it :) #761 |
Fixed by #761, will be in the next release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice to specify the standard explicitly as a method on
Build
, e.g.Build::new().standard("c++14")
. This abstracts from difference between GCC/Clang-std=
and MSVC/std:
. Questions to answer:gnu14
on MSVC: translate to the closestc++14
or give an error?/std:c++20
and requires/std:c++latest
for C++20 features. Shouldstandard("c++20")
test if/std:c++20
works and use/std:c++latest
if it isn't?The text was updated successfully, but these errors were encountered: