Adding CUDAUtilities.cmake
This is the beginning of a CUDAUtilities module, with one function: cmake_cuda_arch_detect. The changes are as follows:
- Moved
select_compute_archfromFindCUDA/toCUDA/. The other three files in FindCUDA are distinctly FindCUDA only files (they aren't evenincludeable), whereas this one is general. - Modernised
CUDA_SELECT_NVCC_ARCH_FLAGSwith keyword parsing and renamed toCMAKE_CUDA_ARCH_SELECT.READABLEoutput is now requestable, and an adapter to the old name and syntax is provided when FindCUDA uses the function. The new function also provides aQUIETtoggle.FLAGSis used to get the flag list. - Added
TARGETS, along withINTERFACE,PUBLIC, andPRIVATEkeywords, to set an interface or compile target flags, property protected withCOMPILE_LANGUAGE. (This will only work with the CUDA as a language mode) - Uses the
--genenerate-codesyntax rather than-gencode, avoiding needing the newSHELL:feature;CUDA_SELECT_NVCC_ARCH_FLAGSconverts back to the old syntax for maximum backward compatibility. Caching improved a bit to ensure 1 run per configure even if the detection fails. - User-facing access to the new function is provided in a new
CUDAUtilitiesmodule, mimicking the name of theCSharpUtilitiessmodule already in CMake. A future pull request with a new function (convert CXX to CUDA flags) in CUDAUtilities is planned. - A test has been added,
CudaOnly.ArchFlags.
See issues: #16586 (closed), #17408 (closed).
Followup to !1856 (merged) .
Edited by Henry Schreiner