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_arch
fromFindCUDA/
toCUDA/
. The other three files in FindCUDA are distinctly FindCUDA only files (they aren't eveninclude
able), whereas this one is general. - Modernised
CUDA_SELECT_NVCC_ARCH_FLAGS
with keyword parsing and renamed toCMAKE_CUDA_ARCH_SELECT
.READABLE
output is now requestable, and an adapter to the old name and syntax is provided when FindCUDA uses the function. The new function also provides aQUIET
toggle.FLAGS
is used to get the flag list. - Added
TARGETS
, along withINTERFACE
,PUBLIC
, andPRIVATE
keywords, 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-code
syntax rather than-gencode
, avoiding needing the newSHELL:
feature;CUDA_SELECT_NVCC_ARCH_FLAGS
converts 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
CUDAUtilities
module, mimicking the name of theCSharpUtilitiess
module 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.
Followup to !1856 (merged) .
Edited by Henry Schreiner