remove MDSPAN_CXX_STANDARD
#421
Draft
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_STANDARD
is newer, cmake will provide the target the newer C++ standard flags. The idea is thatCMAKE_CXX_STANDARD
should only be provided by the user.If
CMAKE_CXX_STANDARD
is 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_STANDARD
to 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_features
approach.