-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Update CMake and documentation to use C++17 standard #189
Comments
The issue with that is we are trying to be more lenient about the versions people have available to them. My thinking has been that we should try to support at least what's available on Ubuntu LTS, as it's the oldest reasonable version. See people asking in #195 for instance. Not all the OS's and distributions have updated to C++17 in their default toolchain, and many people are on older releases from before C++17 was released anyways. What do you think? |
Well, that's makes sense. But I think we must at least clarify that students can submit their solutions using newer standard (e.g. make a note that student is allowed to change the standard in CMake) I guess it will be fine. |
Oh, that's a good point. We need to support a relatively old version for the code we provide but not restrict the students from using a newer standard. I'd rather not force people to edit the CMake files just to code in C++14. If we just remove the |
Can't we use conditionals on the compiler version? But to be honest, lets consider, I change that line to be C++17 using In this download there will still be the original How can we handle this? |
To answer my own question, leaving off the flag just uses the compilers default std for compilation (currently the latest gcc default is C++14). If we use conditionals on the compiler version in CMake, we'd just be further complicating things. The only way to get around these issues is actually just to lock to one particular C++ version, and push people to use that. A student can always edit the CMake file to get a later (or earlier, if they wanted) version to compile though, so it's not perfect. We can look at moving the CMake setting up to C++14 if the compilers we want to support can use it. @NobbZ - If we give students freedom to use the latest versions, there's not an easy way to handle that scenario other than just letting the mentors figure it out. I would expect the mentors to be able to get a reasonably up to date compiler on their system. |
Are you willing/able to upgrade the version of CMake to 3.1.3? If so, there is a feature that allows one to both specify the default C++ standard and also to enable/disable C++ standard rollback. Although it may provide value, I hesitate to suggest a change to such a basic tool. Will this work with Exercism's current build tools? Will this alienate students running software from 2013, i.e., CMake 2.8? Something like this:
Disabling CXX_EXTENSIONS prevents CMake from adding GNU extensions, which it enables by default. CMake 3.1.3 only supports up to C++14; it looks like they added support for C++17 in version 3.8. |
CMake 3.1.3 is definitely old enough to make a minimum requirement. Ubuntu 16.04 ships with CMake 3.5, and that's a a fairly reasonable lower bar for us to set our min requirements to. I know that a 'modern' CMake file can be a lot easier/cleaner to write than what we have here. Modernizing the CMake files is on my list of things that may eventually be a good idea to do, but I don't have a lot of experience with writing CMake files so it would take some effort to do it myself. I would be very happy though if somebody took that up though :) That feature looks like a much better way to specify the version, and I think setting that up to support C++14 is probably fine at this point. I'll probably still be a little careful to make sure that the test files we are providing will still compile for C++11 just in case though. |
Sounds good. It didn't occur to me to reference a different issue - only takes a '#'. I'll comment over there. |
Turns out that upgrading to C++14 actually breaks the Clang build. I've created a branch that updates only the C++ standard to illustrate this. You can see a diff and Travis CI failure. At Stack Overflow's recommendation, I experimented with installing Further experimentation required - I don't have much experience with Clang (yet). |
Most modern compilers are already support newest C++17 standard, so I think CMake files among with documentation should be updated to require compiller with C++17 support.
The text was updated successfully, but these errors were encountered: