CMP0104 NEW Behavior doesn't allow easily controlling default architectures
Due to the default initialization rules of CMAKE_CUDA_ARCHITECTURES
, it makes it very difficult for library maintainers to differentiate between a user passing in an architecture via -DCMAKE_CUDA_ARCHITECTURES
versus a default initialization of a typically very old architecture.
For example, say I have a library where I want to target Volta, Turing, and Ampere architectures by default (70, 75, 80). With CMP0104 set to OLD, I can do something like:
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 70 75 80)
endif(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
With CMP0104 set to NEW, CMAKE_CUDA_ARCHITECTURES
will default initialize to a value based on my nvcc
version (for CUDA 11.0 this is 52 which is Maxwell architecture). The problem is there's no way for me to tell if CMAKE_CUDA_ARCHITECTURES
was default initialized to 52 or was set via something like -DCMAKE_CUDA_ARCHITECTURES=52
.
I'm not sure how much sense it makes to default to the oldest architecture supported by nvcc
in this situation, but it would be really nice to be able to override the default value without blocking users from being able to specify values themselves via standard CMake variables.