blt
blt copied to clipboard
Revamp CUDA support in BLT
The CMake code in SetupCUDA.cmake
seems to be relying on both find_package(CUDA)
, which was deprecated since CMake 3.10, and the modern first-class CUDA language support in CMake.
Using both is confusing.
This part can be refined and cleaned up quite a bit and we should consider leveraging FindCUDAToolkit(https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html#) that is available with newer versions of CMake as applicable.
Just to add to this issue so it's not forgotten. At the time this line (https://github.com/LLNL/blt/blob/0d71af8d3ac0ea1abeb8983a201013753a857a35/cmake/SetupCompilerOptions.cmake#L268) was implemented, CMake did not support C++17 or higher when compiling CUDA. Newer versions of CMake now support all the way up to C++20. This check should be improved to check which CMake version you are running and error out only if that version doesn't support higher C++ standards.
For versions of CMake where FindCUDAToolkit is not available, https://gitlab.kitware.com/cmake/cmake/-/issues/17816 describes how similar functionality can be implemented without relying on FindCUDA.cmake
.