CUDA: Support setting CUDA14/17 when using MSVC
I just discovered that my CI harness was not testing the C++17 configuration for my CUDA targets, because my CMake was too old to know about the CUDA_STANDARD
target property value of 17
. Up until the yet-to-be-released CMake 3.18, CUDA_STANDARD only handled up to C++14.
I had set the target property CUDA_STANDARD_REQUIRED=ON
, but it apparently has no effect. CMake happily and silently configured my C++17 CUDA targets to build without any standard flags on MSVC 2019, meaning I ended up a ton of redundant C++14 targets while mistakenly thinking I had C++17 coverage.
Thankfully manual QA testing caught the issues before our release, but this is very frustrating and allowed several bugs to slip in that must now be fixed on a short deadline.
Why doesn't CUDA_STANDARD_REQUIRED
work? Is there any way I can configure my CMake scripts to prevent this from happening in the future?
I'm bumping the minimum CMake version as a workaround, but the larger issue still remains -- there needs to be some way to get a diagnostic for this. Silent failure should not be the only option.