Draft
Conversation
1d76f5d to
3b14612
Compare
3b14612 to
baf0459
Compare
Contributor
Author
|
So a funny thing is that now even the C++14 tests run the C++17 requiring tests (in C++17 mode, though the other non-c++17 requiring tests tests are in C++14) because the compiler supports C++17. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also reworks the way we set the C++ Standard. I marked this as a draft since I'm not 100% yet we should go this way. There is an alternate approach.
This approach works by setting a required standard per target via
target_compile_features. The way this works is that ifCMAKE_CXX_STANDARDis newer, cmake will provide the target the newer C++ standard flags. The idea is thatCMAKE_CXX_STANDARDshould only be provided by the user.If
CMAKE_CXX_STANDARDis lower than the required standard of some of the targets, cmake will still use the higher standard flags (assuming the compiler supports them).The lowest feature flag is
cxx_std_14; it means that if the user doesn't have a compiler supporting C++14 cmake should error. Some of the tests are predicated on the compiler supporting newer standards.Finally, I still need to figure out how this should work with CUDA/HIP; thus, this should stay a draft until I can sort that.
Alternative approach
We can instead check user-provided
CMAKE_CXX_STANDARDto make sure it's at least 14; if it is not set we can initialize it to the default. This is less verbose, so we set the standard for all of the targets at once. We can still set per-target properties forCXX_STANDARD, though if we do that I'd prefer thetarget_compile_featuresapproach.