Skip to content

Conversation

nmm0
Copy link
Contributor

@nmm0 nmm0 commented Jun 18, 2025

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 if CMAKE_CXX_STANDARD is newer, cmake will provide the target the newer C++ standard flags. The idea is that CMAKE_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 for CXX_STANDARD, though if we do that I'd prefer the target_compile_features approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant